@@ -27,6 +27,7 @@
/* There is some commonality. */
#include <sysdeps/unix/sysv/linux/sysdep.h>
#include <sysdeps/unix/alpha/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
#include <tls.h>
@@ -23,6 +23,7 @@
/* There is some commonality. */
#include <sysdeps/unix/sysv/linux/sysdep.h>
#include <sysdeps/unix/arm/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
/* Defines RTLD_PRIVATE_ERRNO and USE_DL_SYSINFO. */
#include <dl-sysdep.h>
@@ -22,7 +22,9 @@
#include <sysdeps/unix/sysv/linux/sysdep.h>
/* Provide the common name to allow more code reuse. */
+#ifndef __NR__llseek
#define __NR__llseek __NR_llseek
+#endif
#if __WORDSIZE == 64
/* By defining the older names, glibc will build syscall wrappers for
@@ -41,3 +43,14 @@
#define __ALIGNMENT_ARG
#define __ALIGNMENT_COUNT(a,b) a
#endif
+
+/* Provide a common macro to pass 64-bit value on syscalls. */
+#if __WORDSIZE == 64 || defined __ASSUME_WORDSIZE64_ILP32
+# define SYSCALL_LL(__val) (__val)
+# define SYSCALL_LL64(__val) (__val)
+#else
+#define SYSCALL_LL(__val) \
+ __LONG_LONG_PAIR (__val >> 31, __val)
+#define SYSCALL_LL64(__val) \
+ __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff))
+#endif
@@ -24,6 +24,7 @@
#include <sysdeps/unix/sysdep.h>
#include <sysdeps/unix/sysv/linux/sysdep.h>
#include <sysdeps/hppa/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
/* Defines RTLD_PRIVATE_ERRNO. */
#include <dl-sysdep.h>
@@ -22,6 +22,7 @@
/* There is some commonality. */
#include <sysdeps/unix/sysv/linux/sysdep.h>
#include <sysdeps/unix/i386/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
/* Defines RTLD_PRIVATE_ERRNO and USE_DL_SYSINFO. */
#include <dl-sysdep.h>
#include <tls.h>
@@ -22,6 +22,7 @@
#include <sysdeps/unix/sysdep.h>
#include <sysdeps/unix/sysv/linux/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
#include <sysdeps/ia64/sysdep.h>
#include <dl-sysdep.h>
#include <tls.h>
@@ -18,6 +18,7 @@
<http://www.gnu.org/licenses/>. */
#include <sysdeps/unix/sysv/linux/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
#include <tls.h>
/* Defines RTLD_PRIVATE_ERRNO. */
@@ -22,6 +22,7 @@
#include <sysdeps/unix/sysdep.h>
#include <sysdeps/unix/sysv/linux/sysdep.h>
#include <sysdeps/microblaze/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
/* Defines RTLD_PRIVATE_ERRNO. */
#include <dl-sysdep.h>
@@ -53,3 +53,9 @@
#if _MIPS_SIM == _ABIO32
# define __ASSUME_ALIGNED_REGISTER_PAIRS 1
#endif
+
+/* Define that mips64-n32 is a ILP32 ABI to set the correct interface to
+ pass 64-bits values through syscalls. */
+#if _MIPS_SIM == _ABIN32
+# define __ASSUME_WORDSIZE64_ILP32 1
+#endif
@@ -21,6 +21,7 @@
/* There is some commonality. */
#include <sysdeps/unix/sysv/linux/sysdep.h>
#include <sysdeps/unix/mips/mips32/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
#include <tls.h>
@@ -21,6 +21,7 @@
/* There is some commonality. */
#include <sysdeps/unix/sysv/linux/sysdep.h>
#include <sysdeps/unix/mips/mips64/n32/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
#include <tls.h>
@@ -21,6 +21,7 @@
/* There is some commonality. */
#include <sysdeps/unix/sysv/linux/sysdep.h>
#include <sysdeps/unix/mips/mips64/n64/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
#include <tls.h>
@@ -20,6 +20,7 @@
#include <sysdeps/unix/sysv/linux/sysdep.h>
#include <sysdeps/unix/powerpc/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
#include <tls.h>
/* Some systen calls got renamed over time, but retained the same semantics.
@@ -22,6 +22,7 @@
#include <sysdeps/unix/sysv/linux/sysdep.h>
#include <sysdeps/unix/powerpc/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
#include <tls.h>
/* Define __set_errno() for INLINE_SYSCALL macro below. */
@@ -22,6 +22,7 @@
#include <sysdeps/s390/s390-32/sysdep.h>
#include <sysdeps/unix/sysdep.h>
#include <sysdeps/unix/sysv/linux/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
#include <dl-sysdep.h> /* For RTLD_PRIVATE_ERRNO. */
#include <tls.h>
@@ -23,6 +23,7 @@
#include <sysdeps/s390/s390-64/sysdep.h>
#include <sysdeps/unix/sysdep.h>
#include <sysdeps/unix/sysv/linux/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
#include <dl-sysdep.h> /* For RTLD_PRIVATE_ERRNO. */
#include <tls.h>
@@ -23,6 +23,7 @@
/* There is some commonality. */
#include <sysdeps/unix/sysv/linux/sysdep.h>
#include <sysdeps/unix/sh/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
#include <tls.h>
/* For Linux we can use the system call table in the header file
@@ -22,6 +22,7 @@
#include <sysdeps/unix/sysdep.h>
#include <sysdeps/unix/sysv/linux/sysdep.h>
#include <sysdeps/sparc/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
#ifdef __ASSEMBLER__
@@ -35,4 +35,10 @@
# define __ASSUME_GETCPU_SYSCALL 1
#endif
+/* Define that x32 is a ILP32 ABI to set the correct interface to pass
+ 64-bits values through syscalls. */
+#ifdef __ILP32__
+# define __ASSUME_WORDSIZE64_ILP32 1
+#endif
+
#include_next <kernel-features.h>
@@ -21,6 +21,7 @@
/* There is some commonality. */
#include <sysdeps/unix/sysv/linux/sysdep.h>
#include <sysdeps/unix/x86_64/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
#include <tls.h>
#if IS_IN (rtld)
From: Adhemerval Zanella <adhemerval.zanella@linaro.com> This patch add two new macros to use along with off_t and off64_t argument syscalls. The rationale for this change is: 1. Remove multiple implementations for the same syscall for different architectures (for instance, pread have 6 different implementations). 2. Also remove the requirement to use syscall wrappers for cancellable entrypoints. The macro usage should be used along __ALIGNMENT_ARG to follow ABI constrains for architecture where it applies. For instance, pread can be rewritten as: return SYSCALL_CANCEL (pread, fd, buf, count, __ALIGNMENT_ARG SYSCALL_LL (offset)); Another macro, SYSCALL_LL64, is provided for off64_t. For ILP32 ABI with 64-bits kernel registers pass interface a new defined is used, __ASSUME_WORDSIZE64_ILP32, to indicate that the SYSCALL_LL{64} should be uses as for a 64-bit ABI. The changes itself are not currently used in any implementation, so no code change is expected. * sysdeps/unix/sysv/linux/alpha/sysdep.h: Include generic sysdep.h. * sysdeps/unix/sysv/linux/arm/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/hppa/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/i386/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/ia64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/m68k/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/microblaze/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/sh/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/generic/sysdep.h (__NR__llseek): Define only if it is not already defined. (SYSCALL_LL): Define. (SYSCALL_LL64): Likewise. * sysdeps/unix/sysv/linux/x86_64/kernel-features.h [__ILP32] (__ASSUME_WORDSIZE64_ILP32): Define. * sysdeps/unix/sysv/linux/mips/kernel-features.h [_MIPS_SIM == _ABIN32] (__ASSUME_WORDSIZE64_ILP32): Likewise. --- sysdeps/unix/sysv/linux/alpha/sysdep.h | 1 + sysdeps/unix/sysv/linux/arm/sysdep.h | 1 + sysdeps/unix/sysv/linux/generic/sysdep.h | 13 +++++++++++ sysdeps/unix/sysv/linux/hppa/sysdep.h | 1 + sysdeps/unix/sysv/linux/i386/sysdep.h | 1 + sysdeps/unix/sysv/linux/ia64/sysdep.h | 1 + sysdeps/unix/sysv/linux/m68k/sysdep.h | 1 + sysdeps/unix/sysv/linux/microblaze/sysdep.h | 1 + sysdeps/unix/sysv/linux/mips/kernel-features.h | 6 +++++ sysdeps/unix/sysv/linux/mips/mips32/sysdep.h | 1 + sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h | 1 + sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h | 1 + sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h | 1 + sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h | 1 + sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h | 1 + sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h | 1 + sysdeps/unix/sysv/linux/sh/sysdep.h | 1 + sysdeps/unix/sysv/linux/sparc/sysdep.h | 1 + sysdeps/unix/sysv/linux/x86_64/kernel-features.h | 6 +++++ sysdeps/unix/sysv/linux/x86_64/sysdep.h | 1 + 21 files changed, 68 insertions(+)