[PATCH v3 35/48] fstatat{64}: No conversion code is needed for new architectures

Markos Chandras markos.chandras at gmail.com
Wed Jan 23 11:41:59 UTC 2013


From: Markos Chandras <markos.chandras at imgtec.com>

Signed-off-by: Markos Chandras <markos.chandras at imgtec.com>
---
 libc/sysdeps/linux/common/fstatat.c   | 15 +++++++++++++--
 libc/sysdeps/linux/common/fstatat64.c |  4 ++++
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/libc/sysdeps/linux/common/fstatat.c b/libc/sysdeps/linux/common/fstatat.c
index a0bc3cd..2fde220 100644
--- a/libc/sysdeps/linux/common/fstatat.c
+++ b/libc/sysdeps/linux/common/fstatat.c
@@ -19,12 +19,23 @@
 int fstatat(int fd, const char *file, struct stat *buf, int flag)
 {
 	int ret;
+#ifdef __ARCH_HAS_DEPRECATED_SYSCALLS__
 	struct kernel_stat64 kbuf;
-
 	ret = INLINE_SYSCALL(fstatat64, 4, fd, file, &kbuf, flag);
 	if (ret == 0)
 		__xstat32_conv(&kbuf, buf);
-
+#else
+	ret = INLINE_SYSCALL(fstatat64, 4, fd, file, buf, flag);
+	if (ret == 0) {
+		/* Did we overflow */
+		if (buf->__pad1 || buf->__pad2 || buf->__pad3
+		    || buf->__pad4 || buf->__pad5 || buf->__pad6
+		    || buf->__pad7) {
+			__set_errno(EOVERFLOW);
+			return -1;
+		}
+	}
+#endif /* __ARCH_HAS_DEPRECATED_SYSCALLS__ */
 	return ret;
 }
 #else
diff --git a/libc/sysdeps/linux/common/fstatat64.c b/libc/sysdeps/linux/common/fstatat64.c
index 9020fb5..cabed91 100644
--- a/libc/sysdeps/linux/common/fstatat64.c
+++ b/libc/sysdeps/linux/common/fstatat64.c
@@ -20,6 +20,7 @@
 # include "xstatconv.h"
 int fstatat64(int fd, const char *file, struct stat64 *buf, int flag)
 {
+#ifdef __ARCH_HAS_DEPRECATED_SYSCALLS__
 	int ret;
 	struct kernel_stat64 kbuf;
 
@@ -28,6 +29,9 @@ int fstatat64(int fd, const char *file, struct stat64 *buf, int flag)
 		__xstat64_conv(&kbuf, buf);
 
 	return ret;
+#else
+	return INLINE_SYSCALL(fstatat64, 4, fd, file, buf, flag);
+#endif
 }
 #else
 /* should add emulation with fstat64() and /proc/self/fd/ ... */
-- 
1.8.1.1




More information about the uClibc mailing list