[RFC PATCH 33/38] stat64: prefer fstatat64
Jonas Bonn
jonas at southpole.se
Tue Sep 6 08:30:57 UTC 2011
Signed-off-by: Jonas Bonn <jonas at southpole.se>
---
libc/sysdeps/linux/common/stat64.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/libc/sysdeps/linux/common/stat64.c b/libc/sysdeps/linux/common/stat64.c
index a76f182..f4b5e5e 100644
--- a/libc/sysdeps/linux/common/stat64.c
+++ b/libc/sysdeps/linux/common/stat64.c
@@ -9,11 +9,21 @@
#include <sys/syscall.h>
#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
-#if defined __UCLIBC_HAS_LFS__ && defined __NR_stat64
+#if defined __UCLIBC_HAS_LFS__
+
+#ifdef __NR_fstatat64
+int stat64(const char *file_name, struct stat64 *buf)
+{
+ return fstatat64(AT_FDCWD, file_name, buf, 0);
+}
+libc_hidden_def(stat64)
+
+#elif defined __NR_stat64
# define __NR___syscall_stat64 __NR_stat64
-# include <unistd.h>
# include "xstatconv.h"
static __inline__ _syscall2(int, __syscall_stat64,
@@ -32,3 +42,5 @@ int stat64(const char *file_name, struct stat64 *buf)
}
libc_hidden_def(stat64)
#endif
+
+#endif
--
1.7.5.4
More information about the uClibc
mailing list