1 /*
2 * fstatat64() 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 <_lfs_64.h>
10 #include <bits/wordsize.h>
11 #include <sys/syscall.h>
12
13 /* 64bit ports tend to favor newfstatat() */
14 #if __WORDSIZE == 64 && defined __NR_newfstatat
15 # define __NR_fstatat64 __NR_newfstatat
16 #endif
17
18 #ifdef __NR_fstatat64
19 # include <sys/stat.h>
20 # include "xstatconv.h"
fstatat64(int fd,const char * file,struct stat64 * buf,int flag)21 int fstatat64(int fd, const char *file, struct stat64 *buf, int flag)
22 {
23 # ifdef __ARCH_HAS_DEPRECATED_SYSCALLS__
24 int ret;
25 struct kernel_stat64 kbuf;
26
27 ret = INLINE_SYSCALL(fstatat64, 4, fd, file, &kbuf, flag);
28 if (ret == 0)
29 __xstat64_conv(&kbuf, buf);
30
31 return ret;
32 # else
33 return INLINE_SYSCALL(fstatat64, 4, fd, file, buf, flag);
34 # endif
35 }
36 libc_hidden_def(fstatat64)
37 #else
38 /* should add emulation with fstat64() and /proc/self/fd/ ... */
39 #endif
40