[RFC PATCH 30/38] fstat: prefer fstat64 syscall

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


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

diff --git a/libc/sysdeps/linux/common/fstat.c b/libc/sysdeps/linux/common/fstat.c
index acc639b..f3fd48e 100644
--- a/libc/sysdeps/linux/common/fstat.c
+++ b/libc/sysdeps/linux/common/fstat.c
@@ -12,6 +12,21 @@
 #include <sys/stat.h>
 #include "xstatconv.h"
 
+#ifdef __NR_fstat64
+int fstat(int fd, struct stat *buf)
+{
+	int result;
+	struct kernel_stat64 kbuf;
+
+        result = INLINE_SYSCALL(fstat64, 2, fd, &kbuf);
+	if (result == 0) {
+		__xstat32_conv(&kbuf, buf);
+	}
+	return result;
+}
+libc_hidden_def(fstat)
+
+#elif defined __NR_fstat
 #define __NR___syscall_fstat __NR_fstat
 static __inline__ _syscall2(int, __syscall_fstat, int, fd, struct kernel_stat *, buf)
 
@@ -26,9 +41,15 @@ int fstat(int fd, struct stat *buf)
 	}
 	return result;
 }
+
 libc_hidden_def(fstat)
 
-#if ! defined __NR_fstat64 && defined __UCLIBC_HAS_LFS__
+#if defined __UCLIBC_HAS_LFS__
 strong_alias_untyped(fstat,fstat64)
 libc_hidden_def(fstat64)
 #endif
+
+#endif
+
+
+
-- 
1.7.5.4



More information about the uClibc mailing list