[2/4] Consolidate off_t/off64_t syscall argument passing
Commit Message
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.
The changes itself are not currently used in any implementation, so no
code change is expected.
* sysdeps/unix/sysv/linux/aarch64/sysdep.h (SYSCALL_LL): New
macro.
(SYSCALL_LL64): Likewise.
* sysdeps/unix/sysv/linux/alpha/sysdep.h (SYSCALL_LL): Likewise.
(SYSCALL_LL64): Likewise.
* sysdeps/unix/sysv/linux/arm/sysdep.h (SYSCALL_LL): New macro.
(SYSCALL_LL64): Likewise.
* sysdeps/unix/sysv/linux/generic/sysdep.h (__NR__llseek): Define only
if it is not already defined.
* sysdeps/unix/sysv/linux/hppa/sysdep.h (SYSCALL_LL): New macro.
(SYSCALL_LL64): Likewise.
* sysdeps/unix/sysv/linux/i386/sysdep.h (SYSCALL_LL): Likewise.
(SYSCALL_LL64): Likewise.
* sysdeps/unix/sysv/linux/ia64/sysdep.h (SYSCALL_LL): Likewise.
(SYSCALL_LL64): Likewise.
* sysdeps/unix/sysv/linux/m68k/sysdep.h (SYSCALL_LL): Likewise.
(SYSCALL_LL64): Likewise.
* sysdeps/unix/sysv/linux/microblaze/sysdep.h (SYSCALL_LL):
Likewise.
(SYSCALL_LL64): Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/sysdep.h (SYSCALL_LL): New
Macro.
(SYSCALL_LL64): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h (SYSCALL_LL):
New macro.
(SYSCALL_LL64): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h (SYSCALL_LL):
Likewise.
(SYSCALL_LL64): Likewise.
* sysdeps/unix/sysv/linux/nios2/sysdep.h (SYSCALL_LL): Likewise.
(SYSCALL_LL64): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h (SYSCALL_LL):
New macro.
(SYSCALL_LL64): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h (SYSCALL_LL):
Likewise.
(SYSCALL_LL64): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h (SYSCALL_LL):
Likewise.
(SYSCALL_LL64): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h (SYSCALL_LL):
Likewise.
(SYSCALL_LL64): Likewise.
* sysdeps/unix/sysv/linux/sh/sysdep.h (SYSCALL_LL):
Likewise.
(SYSCALL_LL64): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h (SYSCALL_LL):
Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h (SYSCALL_LL64):
Likewise.
* sysdeps/unix/sysv/linux/sparc/sysdep.h: Include generic sysdep.h.
* sysdeps/unix/sysv/linux/tile/sysdep.h (SYSCALL_LL): New macro.
(SYSCALL_LL64): Likewise.
* sysdeps/unix/sysv/linux/x86_64/sysdep.h (SYSCALL_LL): Likewise.
(SYSCALL_LL64): Likewise.
---
sysdeps/unix/sysv/linux/aarch64/sysdep.h | 3 ++
sysdeps/unix/sysv/linux/alpha/sysdep.h | 5 ++
sysdeps/unix/sysv/linux/arm/sysdep.h | 7 +++
sysdeps/unix/sysv/linux/generic/sysdep.h | 2 +
sysdeps/unix/sysv/linux/hppa/sysdep.h | 7 +++
sysdeps/unix/sysv/linux/i386/sysdep.h | 7 +++
sysdeps/unix/sysv/linux/ia64/sysdep.h | 5 ++
sysdeps/unix/sysv/linux/m68k/sysdep.h | 7 +++
sysdeps/unix/sysv/linux/microblaze/sysdep.h | 7 +++
sysdeps/unix/sysv/linux/mips/mips32/sysdep.h | 7 +++
sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h | 5 ++
sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h | 5 ++
sysdeps/unix/sysv/linux/nios2/sysdep.h | 6 +++
sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h | 7 +++
sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h | 5 ++
sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h | 7 +++
sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h | 5 ++
sysdeps/unix/sysv/linux/sh/sysdep.h | 7 +++
sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h | 6 +++
sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h | 4 ++
sysdeps/unix/sysv/linux/sparc/sysdep.h | 1 +
sysdeps/unix/sysv/linux/tile/sysdep.h | 6 +++
sysdeps/unix/sysv/linux/x86_64/sysdep.h | 6 +++
24 files changed, 189 insertions(+)
Comments
On 18 Nov 2015 12:02, Adhemerval Zanella wrote:
> 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.
>
> The changes itself are not currently used in any implementation, so no
> code change is expected.
a quick scan looks like you're doing this purely along 32-bit/64-bit lines.
why not add the 32-bit definition to sysdeps/unix/sysv/linux/sysdep.h and
the 64-bit definition to sysdeps/unix/sysv/linux/wordsize-64/sysdep.h ?
sysdeps/unix/sysv/linux/sysdep.h:
#ifndef SYSCALL_LL
# define SYSCALL_LL ...
#endif
sysdeps/unix/sysv/linux/wordsize-64/sysdep.h:
#define SYSCALL_LL ...
#include <sysdeps/unix/sysv/linux/sysdep.h>
you would have to update all the 64-bit arches to pull in the wordsize-64
header since it looks like sysdep.h has a lot of direct includes rather
than stacking & using include_next.
-mike
On 29-12-2015 15:24, Mike Frysinger wrote:
> On 18 Nov 2015 12:02, Adhemerval Zanella wrote:
>> 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.
>>
>> The changes itself are not currently used in any implementation, so no
>> code change is expected.
>
> a quick scan looks like you're doing this purely along 32-bit/64-bit lines.
> why not add the 32-bit definition to sysdeps/unix/sysv/linux/sysdep.h and
> the 64-bit definition to sysdeps/unix/sysv/linux/wordsize-64/sysdep.h ?
>
> sysdeps/unix/sysv/linux/sysdep.h:
> #ifndef SYSCALL_LL
> # define SYSCALL_LL ...
> #endif
>
> sysdeps/unix/sysv/linux/wordsize-64/sysdep.h:
> #define SYSCALL_LL ...
> #include <sysdeps/unix/sysv/linux/sysdep.h>
>
> you would have to update all the 64-bit arches to pull in the wordsize-64
> header since it looks like sysdep.h has a lot of direct includes rather
> than stacking & using include_next.
> -mike
>
I think it can be done, however I would like to avoid creating and setting
the 64-bit arches to use the new header disassociated if the arch actually
use the wordsize-64 implementation (I see this to be a follow up cleanup).
On 04 Jan 2016 10:33, Adhemerval Zanella wrote:
> On 29-12-2015 15:24, Mike Frysinger wrote:
> > On 18 Nov 2015 12:02, Adhemerval Zanella wrote:
> >> 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.
> >>
> >> The changes itself are not currently used in any implementation, so no
> >> code change is expected.
> >
> > a quick scan looks like you're doing this purely along 32-bit/64-bit lines.
> > why not add the 32-bit definition to sysdeps/unix/sysv/linux/sysdep.h and
> > the 64-bit definition to sysdeps/unix/sysv/linux/wordsize-64/sysdep.h ?
> >
> > sysdeps/unix/sysv/linux/sysdep.h:
> > #ifndef SYSCALL_LL
> > # define SYSCALL_LL ...
> > #endif
> >
> > sysdeps/unix/sysv/linux/wordsize-64/sysdep.h:
> > #define SYSCALL_LL ...
> > #include <sysdeps/unix/sysv/linux/sysdep.h>
> >
> > you would have to update all the 64-bit arches to pull in the wordsize-64
> > header since it looks like sysdep.h has a lot of direct includes rather
> > than stacking & using include_next.
>
> I think it can be done, however I would like to avoid creating and setting
> the 64-bit arches to use the new header disassociated if the arch actually
> use the wordsize-64 implementation (I see this to be a follow up cleanup).
can you at least do it for the 32-bit ones now and leave a TODO comment ?
-mike
On 04-01-2016 22:54, Mike Frysinger wrote:
> On 04 Jan 2016 10:33, Adhemerval Zanella wrote:
>> On 29-12-2015 15:24, Mike Frysinger wrote:
>>> On 18 Nov 2015 12:02, Adhemerval Zanella wrote:
>>>> 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.
>>>>
>>>> The changes itself are not currently used in any implementation, so no
>>>> code change is expected.
>>>
>>> a quick scan looks like you're doing this purely along 32-bit/64-bit lines.
>>> why not add the 32-bit definition to sysdeps/unix/sysv/linux/sysdep.h and
>>> the 64-bit definition to sysdeps/unix/sysv/linux/wordsize-64/sysdep.h ?
>>>
>>> sysdeps/unix/sysv/linux/sysdep.h:
>>> #ifndef SYSCALL_LL
>>> # define SYSCALL_LL ...
>>> #endif
>>>
>>> sysdeps/unix/sysv/linux/wordsize-64/sysdep.h:
>>> #define SYSCALL_LL ...
>>> #include <sysdeps/unix/sysv/linux/sysdep.h>
>>>
>>> you would have to update all the 64-bit arches to pull in the wordsize-64
>>> header since it looks like sysdep.h has a lot of direct includes rather
>>> than stacking & using include_next.
>>
>> I think it can be done, however I would like to avoid creating and setting
>> the 64-bit arches to use the new header disassociated if the arch actually
>> use the wordsize-64 implementation (I see this to be a follow up cleanup).
>
> can you at least do it for the 32-bit ones now and leave a TODO comment ?
> -mike
>
Right, I will change that.
@@ -151,6 +151,9 @@
#else /* not __ASSEMBLER__ */
+/* No adjustment required to pass long long on syscalls. */
+# define SYSCALL_LL(__val) (__val)
+# define SYSCALL_LL64(__val) (__val)
/* List of system calls which are supported as vsyscalls. */
# define HAVE_CLOCK_GETRES_VSYSCALL 1
@@ -27,9 +27,14 @@
/* 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>
+/* No adjustment required to pass long long on syscalls. */
+#define SYSCALL_LL(__val) (__val)
+#define SYSCALL_LL64(__val) (__val)
+
/* For Linux we can use the system call table in the header file
/usr/include/asm/unistd.h
of the kernel. But these symbols do not follow the SYS_* syntax
@@ -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>
@@ -317,6 +318,12 @@ __local_syscall_error: \
#else /* not __ASSEMBLER__ */
+/* Macro to adjust 'long long' argument for syscalls. */
+#define SYSCALL_LL(__val) \
+ __LONG_LONG_PAIR (__val >> 31, __val)
+#define SYSCALL_LL64(__val) \
+ __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff))
+
/* Define a macro which expands into the inline wrapper code for a system
call. */
#undef INLINE_SYSCALL
@@ -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
@@ -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>
@@ -351,6 +352,12 @@ L(pre_end): ASM_LINE_SEP \
#else
+/* Macro to adjust 'long long' argument for syscalls. */
+#define SYSCALL_LL(__val) \
+ __LONG_LONG_PAIR (__val >> 31, __val)
+#define SYSCALL_LL64(__val) \
+ __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff))
+
/* GCC has to be warned that a syscall may clobber all the ABI
registers listed as "caller-saves", see page 8, Table 2
in section 2.2.6 of the PA-RISC RUN-TIME architecture
@@ -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>
@@ -233,6 +234,12 @@
#else /* !__ASSEMBLER__ */
+/* Macro to adjust 'long long' argument for syscalls. */
+#define SYSCALL_LL(__val) \
+ __LONG_LONG_PAIR (__val >> 31, __val)
+#define SYSCALL_LL64(__val) \
+ __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff))
+
extern int __syscall_error (int)
attribute_hidden __attribute__ ((__regparm__ (1)));
@@ -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>
@@ -186,6 +187,10 @@
#else /* not __ASSEMBLER__ */
+/* No adjustment required to pass long long on syscalls. */
+#define SYSCALL_LL(__val) (__val)
+#define SYSCALL_LL64(__val) (__val)
+
#define BREAK_INSN_1(num) "break " #num ";;\n\t"
#define BREAK_INSN(num) BREAK_INSN_1(num)
@@ -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. */
@@ -221,6 +222,12 @@ SYSCALL_ERROR_LABEL: \
#else /* not __ASSEMBLER__ */
+/* Macro to adjust 'long long' argument for syscalls. */
+#define SYSCALL_LL(__val) \
+ __LONG_LONG_PAIR (__val >> 31, __val)
+#define SYSCALL_LL64(__val) \
+ __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff))
+
/* Define a macro which expands into the inline wrapper code for a system
call. */
#undef INLINE_SYSCALL
@@ -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>
@@ -163,6 +164,12 @@ SYSCALL_ERROR_LABEL_DCL: \
#else /* not __ASSEMBLER__ */
+/* Macro to adjust 'long long' argument for syscalls. */
+#define SYSCALL_LL(__val) \
+ __LONG_LONG_PAIR (__val >> 31, __val)
+#define SYSCALL_LL64(__val) \
+ __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff))
+
/* Define a macro which expands into the inline wrapper code for a system
call. */
# undef INLINE_SYSCALL
@@ -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>
@@ -46,6 +47,12 @@
#else /* ! __ASSEMBLER__ */
+/* Macro to adjust 'long long' argument for syscalls. */
+#define SYSCALL_LL(__val) \
+ __LONG_LONG_PAIR (__val >> 31, offset)
+#define SYSCALL_LL64(__val) \
+ __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff))
+
/* Define a macro which expands into the inline wrapper code for a system
call. */
#undef INLINE_SYSCALL
@@ -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>
@@ -44,6 +45,10 @@
#else /* ! __ASSEMBLER__ */
+/* No adjustment required to pass long long on syscalls. */
+#define SYSCALL_LL(__val) (__val)
+#define SYSCALL_LL64(__val) (__val)
+
/* Convert X to a long long, without losing any bits if it is one
already or warning if it is a 32-bit pointer. */
#define ARGIFY(X) ((long long) (__typeof__ ((X) - (X))) (X))
@@ -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>
@@ -44,6 +45,10 @@
#else /* ! __ASSEMBLER__ */
+/* No adjustment required to pass long long on syscalls. */
+#define SYSCALL_LL(__val) (__val)
+#define SYSCALL_LL64(__val) (__val)
+
/* Define a macro which expands into the inline wrapper code for a system
call. */
#undef INLINE_SYSCALL
@@ -137,6 +137,12 @@
#else /* __ASSEMBLER__ */
+/* Macro to adjust 'long long' argument for syscalls. */
+#define SYSCALL_LL(__val) \
+ __LONG_LONG_PAIR (__val >> 31, __val)
+#define SYSCALL_LL64(__val) \
+ __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff))
+
/* In order to get __set_errno() definition in INLINE_SYSCALL. */
#include <errno.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.
@@ -51,6 +52,12 @@
# include <errno.h>
+/* Macro to adjust 'long long' argument for syscalls. */
+# define SYSCALL_LL(__val) \
+ __LONG_LONG_PAIR (offset >> 31, offset)
+# define SYSCALL_LL64(__val) \
+ __LONG_LONG_PAIR ((long) (__val >> 32), (long) __val)
+
/* Define a macro which expands inline into the wrapper code for a VDSO
call. This use is for internal calls that do not need to handle errors
normally. It will never touch errno.
@@ -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. */
@@ -62,6 +63,10 @@
#endif /* __ASSEMBLER__ */
+/* No adjustment required to pass long long on syscalls. */
+#define SYSCALL_LL(__val) (__val)
+#define SYSCALL_LL64(__val) (__val)
+
/* This version is for internal uses when there is no desire
to set errno */
#define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, type, nr, args...) \
@@ -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>
@@ -179,6 +180,12 @@
#endif /* __ASSEMBLER__ */
+/* Macro to adjust 'long long' argument for syscalls. */
+#define SYSCALL_LL(__val) \
+ __LONG_LONG_PAIR (__val >> 31, __val)
+#define SYSCALL_LL64(__val) \
+ __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff))
+
#undef INLINE_SYSCALL
#define INLINE_SYSCALL(name, nr, args...) \
({ \
@@ -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>
@@ -185,6 +186,10 @@
#endif /* __ASSEMBLER__ */
+/* No adjustment required to pass long long on syscalls. */
+#define SYSCALL_LL(__val) (__val)
+#define SYSCALL_LL64(__val) (__val)
+
#undef INLINE_SYSCALL
#define INLINE_SYSCALL(name, nr, args...) \
({ \
@@ -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
@@ -191,6 +192,12 @@
#else /* not __ASSEMBLER__ */
+/* Macro to adjust 'long long' argument for syscalls. */
+#define SYSCALL_LL(__val) \
+ __LONG_LONG_PAIR (__val >> 31, __val)
+#define SYSCALL_LL64(__val) \
+ __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff))
+
#define SYSCALL_INST_STR0 "trapa #0x10\n\t"
#define SYSCALL_INST_STR1 "trapa #0x11\n\t"
#define SYSCALL_INST_STR2 "trapa #0x12\n\t"
@@ -107,6 +107,12 @@ ENTRY(name); \
#else /* __ASSEMBLER__ */
+/* Macro to adjust 'long long' argument for syscalls. */
+#define SYSCALL_LL(__val) \
+ __LONG_LONG_PAIR (__val >> 31, __val)
+#define SYSCALL_LL64(__val) \
+ __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff))
+
#define __SYSCALL_STRING \
"ta 0x10;" \
"bcc 1f;" \
@@ -116,6 +116,10 @@ ENTRY(name); \
#else /* __ASSEMBLER__ */
+/* No adjustment required to pass long long on syscalls. */
+#define SYSCALL_LL(__val) (__val)
+#define SYSCALL_LL64(__val) (__val)
+
#define __SYSCALL_STRING \
"ta 0x6d;" \
"bcc,pt %%xcc, 1f;" \
@@ -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__
@@ -78,6 +78,12 @@
#include <errno.h>
+/* Macro to adjust 'long long' argument for syscalls. */
+#define SYSCALL_LL(__val) \
+ __LONG_LONG_PAIR (__val >> 31, __val)
+#define SYSCALL_LL64(__val) \
+ __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff))
+
/* Define a macro which expands inline into the wrapper code for a system
call. */
# undef INLINE_SYSCALL
@@ -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)
@@ -188,6 +189,11 @@
# define DOARGS_6 DOARGS_5
#else /* !__ASSEMBLER__ */
+
+/* No adjustment required to pass long long on syscalls. */
+# define SYSCALL_LL(__val) (__val)
+# define SYSCALL_LL64(__val) (__val)
+
/* Define a macro which expands inline into the wrapper code for a system
call. */
# undef INLINE_SYSCALL