blob: 33daa7c98b9746d05f9a894733435cd17ff37ecd [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001/*
2 * fstatat() for uClibc
3 *
4 * Copyright (C) 2009 Analog Devices Inc.
5 *
6 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
7 */
8
9#include <sys/syscall.h>
10#include <sys/stat.h>
11#include "xstatconv.h"
12
13/* 64bit ports tend to favor newfstatat() */
14#ifdef __NR_newfstatat
15# define __NR_fstatat64 __NR_newfstatat
16#endif
17
18#ifdef __NR_fstatat64
19int fstatat(int fd, const char *file, struct stat *buf, int flag)
20{
21 int ret;
22 struct kernel_stat64 kbuf;
23
24 ret = INLINE_SYSCALL(fstatat64, 4, fd, file, &kbuf, flag);
25 if (ret == 0)
26 __xstat32_conv(&kbuf, buf);
27
28 return ret;
29}
30#else
31/* should add emulation with fstat() and /proc/self/fd/ ... */
32#endif