[RFC PATCH 35/38] lstat64: prefer fstatat64 syscall

Jonas Bonn jonas at southpole.se
Tue Sep 6 08:30:59 UTC 2011


Signed-off-by: Jonas Bonn <jonas at southpole.se>
---
 libc/sysdeps/linux/common/lstat64.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/libc/sysdeps/linux/common/lstat64.c b/libc/sysdeps/linux/common/lstat64.c
index 235b76d..58e53f6 100644
--- a/libc/sysdeps/linux/common/lstat64.c
+++ b/libc/sysdeps/linux/common/lstat64.c
@@ -9,12 +9,22 @@
 
 #include <sys/syscall.h>
 
-#if defined __UCLIBC_HAS_LFS__ && defined __NR_lstat64
-# include <unistd.h>
-# include <sys/stat.h>
-# include "xstatconv.h"
+#ifdef __UCLIBC_HAS_LFS__
 
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include "xstatconv.h"
 
+
+#ifdef __NR_fstatat64
+int lstat64(const char *file_name, struct stat64 *buf)
+{
+	return fstatat64(AT_FDCWD, file_name, buf, AT_SYMLINK_NOFOLLOW);
+}
+libc_hidden_def(lstat64)
+
+#elif defined __NR_lstat64
 # define __NR___syscall_lstat64 __NR_lstat64
 static __inline__ _syscall2(int, __syscall_lstat64, const char *, file_name,
 		  struct kernel_stat64 *, buf)
@@ -31,5 +41,6 @@ int lstat64(const char *file_name, struct stat64 *buf)
 	return result;
 }
 libc_hidden_def(lstat64)
+#endif
 
 #endif
-- 
1.7.5.4



More information about the uClibc mailing list