summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/fstat.c
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@uclibc-ng.org>2016-10-04 06:51:35 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2017-02-01 17:48:38 +0100
commitdba942c80dc2cfa5768a856fff98e22a755fdd27 (patch)
tree371e775cb6dfec085945f6834aeb9d3b6de36fbe /libc/sysdeps/linux/common/fstat.c
parent9b457baf8d46329f7d7ee2aa084022bb0df88551 (diff)
add experimental aarch64 support
Ported over from GNU C Library and runtime tested in Qemu.
Diffstat (limited to 'libc/sysdeps/linux/common/fstat.c')
-rw-r--r--libc/sysdeps/linux/common/fstat.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/libc/sysdeps/linux/common/fstat.c b/libc/sysdeps/linux/common/fstat.c
index eae3c8006..ac77eb295 100644
--- a/libc/sysdeps/linux/common/fstat.c
+++ b/libc/sysdeps/linux/common/fstat.c
@@ -7,25 +7,26 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include <sys/syscall.h>
+#include <features.h>
#include <unistd.h>
#include <sys/stat.h>
+#include <sys/syscall.h>
+
#include "xstatconv.h"
#if defined __NR_fstat64 && !defined __NR_fstat
int fstat(int fd, struct stat *buf)
{
- int result = INLINE_SYSCALL(fstat64, 2, fd, buf);
- if (result == 0) {
- /* Did we overflow? */
- if (buf->__pad1 || buf->__pad2 || buf->__pad3
- || buf->__pad4 || buf->__pad5
- || buf->__pad6 || buf->__pad7) {
- __set_errno(EOVERFLOW);
- return -1;
- }
- }
- return result;
+ return INLINE_SYSCALL(fstat64, 2, fd, buf);
+}
+libc_hidden_def(fstat)
+
+#elif __WORDSIZE == 64 && defined __NR_newfstatat
+#include <fcntl.h>
+
+int fstat(int fd, struct stat *buf)
+{
+ return INLINE_SYSCALL(fstat, 2, fd, buf);
}
libc_hidden_def(fstat)
@@ -55,10 +56,9 @@ int fstat(int fd, struct stat *buf)
return result;
}
libc_hidden_def(fstat)
+#endif
# if ! defined __NR_fstat64
strong_alias_untyped(fstat,fstat64)
libc_hidden_def(fstat64)
-# endif
-
#endif