summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common
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
parent9b457baf8d46329f7d7ee2aa084022bb0df88551 (diff)
add experimental aarch64 support
Ported over from GNU C Library and runtime tested in Qemu.
Diffstat (limited to 'libc/sysdeps/linux/common')
-rw-r--r--libc/sysdeps/linux/common/fstat.c28
-rw-r--r--libc/sysdeps/linux/common/fstatat.c9
-rw-r--r--libc/sysdeps/linux/common/lstat.c9
-rw-r--r--libc/sysdeps/linux/common/lstat64.c14
-rw-r--r--libc/sysdeps/linux/common/stat.c8
5 files changed, 42 insertions, 26 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
diff --git a/libc/sysdeps/linux/common/fstatat.c b/libc/sysdeps/linux/common/fstatat.c
index 4006814f0..13673d76c 100644
--- a/libc/sysdeps/linux/common/fstatat.c
+++ b/libc/sysdeps/linux/common/fstatat.c
@@ -26,15 +26,6 @@ int fstatat(int fd, const char *file, struct stat *buf, int flag)
__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;
}
diff --git a/libc/sysdeps/linux/common/lstat.c b/libc/sysdeps/linux/common/lstat.c
index 143cc1916..cef9b463d 100644
--- a/libc/sysdeps/linux/common/lstat.c
+++ b/libc/sysdeps/linux/common/lstat.c
@@ -20,6 +20,15 @@ int lstat(const char *file_name, struct stat *buf)
}
libc_hidden_def(lstat)
+#elif __WORDSIZE == 64 && defined __NR_newfstatat
+# include <fcntl.h>
+
+int lstat(const char *file_name, struct stat *buf)
+{
+ return fstatat(AT_FDCWD, file_name, buf, AT_SYMLINK_NOFOLLOW);
+}
+libc_hidden_def(lstat)
+
/* For systems which have both, prefer the old one */
#else
# include "xstatconv.h"
diff --git a/libc/sysdeps/linux/common/lstat64.c b/libc/sysdeps/linux/common/lstat64.c
index c43e53e1d..76637b556 100644
--- a/libc/sysdeps/linux/common/lstat64.c
+++ b/libc/sysdeps/linux/common/lstat64.c
@@ -9,11 +9,19 @@
#include <_lfs_64.h>
#include <sys/syscall.h>
+#include <unistd.h>
+#include <sys/stat.h>
-# include <unistd.h>
-# include <sys/stat.h>
+#if defined __NR_fstatat64 && !defined __NR_lstat
+# include <fcntl.h>
+
+int lstat64(const char *file_name, struct stat64 *buf)
+{
+ return fstatat64(AT_FDCWD, file_name, buf, AT_SYMLINK_NOFOLLOW);
+}
+libc_hidden_def(lstat64)
-#if defined __NR_fstatat64 && !defined __NR_lstat64
+#elif __WORDSIZE == 64 && defined __NR_newfstatat
# include <fcntl.h>
int lstat64(const char *file_name, struct stat64 *buf)
diff --git a/libc/sysdeps/linux/common/stat.c b/libc/sysdeps/linux/common/stat.c
index b3c2a19ea..8e4542a74 100644
--- a/libc/sysdeps/linux/common/stat.c
+++ b/libc/sysdeps/linux/common/stat.c
@@ -21,6 +21,14 @@ int stat(const char *file_name, struct stat *buf)
return fstatat(AT_FDCWD, file_name, buf, 0);
}
+#elif __WORDSIZE == 64 && defined __NR_newfstatat
+# include <fcntl.h>
+
+int stat(const char *file_name, struct stat *buf)
+{
+ return fstatat64(AT_FDCWD, file_name, buf, 0);
+}
+
#else
# include "xstatconv.h"