[RFC PATCH 34/38] lstat: prefer fstatat64 syscall
Jonas Bonn
jonas at southpole.se
Tue Sep 6 08:30:58 UTC 2011
Signed-off-by: Jonas Bonn <jonas at southpole.se>
---
libc/sysdeps/linux/common/lstat.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/libc/sysdeps/linux/common/lstat.c b/libc/sysdeps/linux/common/lstat.c
index aa77447..6d4a7b0 100644
--- a/libc/sysdeps/linux/common/lstat.c
+++ b/libc/sysdeps/linux/common/lstat.c
@@ -9,9 +9,18 @@
#include <sys/syscall.h>
#include <unistd.h>
+#include <fcntl.h>
#include <sys/stat.h>
#include "xstatconv.h"
+#ifdef __NR_fstatat64
+int lstat(const char *file_name, struct stat *buf)
+{
+ return fstatat(AT_FDCWD, file_name, buf, AT_SYMLINK_NOFOLLOW);
+}
+libc_hidden_def(lstat)
+
+#elif defined __NR_lstat
#define __NR___syscall_lstat __NR_lstat
static __inline__ _syscall2(int, __syscall_lstat,
const char *, file_name, struct kernel_stat *, buf)
@@ -27,9 +36,14 @@ int lstat(const char *file_name, struct stat *buf)
}
return result;
}
+
libc_hidden_def(lstat)
#if ! defined __NR_lstat64 && defined __UCLIBC_HAS_LFS__
strong_alias_untyped(lstat,lstat64)
libc_hidden_def(lstat64)
#endif
+
+#endif
+
+
--
1.7.5.4
More information about the uClibc
mailing list