mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-01 10:06:57 +03:00
linux: Consolidate INLINE_SYSCALL
With all Linux ABIs using the expected Linux kABI to indicate syscalls errors, there is no need to replicate the INLINE_SYSCALL. The generic Linux sysdep.h includes errno.h even for !__ASSEMBLER__, which is ok now and it allows cleanup some archaic code that assume otherwise. Checked with a build against all affected ABIs.
This commit is contained in:
@ -17,7 +17,7 @@
|
|||||||
<https://www.gnu.org/licenses/>. */
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <sysdep.h>
|
#include <sysdep.h>
|
||||||
#include <pthread-errnos.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
#ifdef UP
|
#ifdef UP
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
# define READ_THREAD_POINTER() (__builtin_thread_pointer ())
|
# define READ_THREAD_POINTER() (__builtin_thread_pointer ())
|
||||||
#else
|
#else
|
||||||
/* Note: rd must be $v1 to be ABI-conformant. */
|
/* Note: rd must be $v1 to be ABI-conformant. */
|
||||||
# if __mips_isa_rev >= 2
|
# if defined (__mips_isa_rev) && __mips_isa_rev >= 2
|
||||||
# define READ_THREAD_POINTER() \
|
# define READ_THREAD_POINTER() \
|
||||||
({ void *__result; \
|
({ void *__result; \
|
||||||
asm volatile ("rdhwr\t%0, $29" : "=v" (__result)); \
|
asm volatile ("rdhwr\t%0, $29" : "=v" (__result)); \
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
License along with the GNU C Library; if not, see
|
License along with the GNU C Library; if not, see
|
||||||
<https://www.gnu.org/licenses/>. */
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <pthread-errnos.h>
|
#include <errno.h>
|
||||||
|
|
||||||
.globl pthread_spin_trylock
|
.globl pthread_spin_trylock
|
||||||
.type pthread_spin_trylock,@function
|
.type pthread_spin_trylock,@function
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<https://www.gnu.org/licenses/>. */
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <sysdep.h>
|
#include <sysdep.h>
|
||||||
#include <pthread-errnos.h>
|
#include <errno.h>
|
||||||
|
|
||||||
.text
|
.text
|
||||||
ENTRY(pthread_spin_trylock)
|
ENTRY(pthread_spin_trylock)
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<https://www.gnu.org/licenses/>. */
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <sysdep.h>
|
#include <sysdep.h>
|
||||||
#include <pthread-errnos.h>
|
#include <errno.h>
|
||||||
|
|
||||||
.text
|
.text
|
||||||
ENTRY(pthread_spin_trylock)
|
ENTRY(pthread_spin_trylock)
|
||||||
|
@ -16,8 +16,7 @@
|
|||||||
<https://www.gnu.org/licenses/>. */
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <sysdep.h>
|
#include <sysdep.h>
|
||||||
#define _ERRNO_H
|
#include <errno.h>
|
||||||
#include <bits/errno.h>
|
|
||||||
|
|
||||||
#if IS_IN (rtld)
|
#if IS_IN (rtld)
|
||||||
# include <dl-sysdep.h> /* Defines RTLD_PRIVATE_ERRNO. */
|
# include <dl-sysdep.h> /* Defines RTLD_PRIVATE_ERRNO. */
|
||||||
|
@ -17,8 +17,7 @@
|
|||||||
<https://www.gnu.org/licenses/>. */
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <sysdep.h>
|
#include <sysdep.h>
|
||||||
#define _ERRNO_H
|
#include <errno.h>
|
||||||
#include <bits/errno.h>
|
|
||||||
#include <sys/asm.h>
|
#include <sys/asm.h>
|
||||||
|
|
||||||
.set nomips16
|
.set nomips16
|
||||||
|
@ -16,8 +16,7 @@
|
|||||||
<https://www.gnu.org/licenses/>. */
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <sysdep.h>
|
#include <sysdep.h>
|
||||||
#define _ERRNO_H
|
#include <errno.h>
|
||||||
#include <bits/errno.h>
|
|
||||||
|
|
||||||
ENTRY(__syscall_error)
|
ENTRY(__syscall_error)
|
||||||
#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
|
#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
|
||||||
|
@ -170,21 +170,6 @@
|
|||||||
|
|
||||||
# define SINGLE_THREAD_BY_GLOBAL 1
|
# define SINGLE_THREAD_BY_GLOBAL 1
|
||||||
|
|
||||||
/* Define a macro which expands into the inline wrapper code for a system
|
|
||||||
call. */
|
|
||||||
# undef INLINE_SYSCALL
|
|
||||||
# define INLINE_SYSCALL(name, nr, args...) \
|
|
||||||
({ unsigned long _sys_result = INTERNAL_SYSCALL (name, , nr, args); \
|
|
||||||
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\
|
|
||||||
{ \
|
|
||||||
__set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \
|
|
||||||
_sys_result = (unsigned long) -1; \
|
|
||||||
} \
|
|
||||||
(long) _sys_result; })
|
|
||||||
|
|
||||||
# undef INTERNAL_SYSCALL_DECL
|
|
||||||
# define INTERNAL_SYSCALL_DECL(err) do { } while (0)
|
|
||||||
|
|
||||||
# undef INTERNAL_SYSCALL_RAW
|
# undef INTERNAL_SYSCALL_RAW
|
||||||
# define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \
|
# define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \
|
||||||
({ long _sys_result; \
|
({ long _sys_result; \
|
||||||
@ -205,13 +190,6 @@
|
|||||||
# define INTERNAL_SYSCALL_AARCH64(name, err, nr, args...) \
|
# define INTERNAL_SYSCALL_AARCH64(name, err, nr, args...) \
|
||||||
INTERNAL_SYSCALL_RAW(__ARM_NR_##name, err, nr, args)
|
INTERNAL_SYSCALL_RAW(__ARM_NR_##name, err, nr, args)
|
||||||
|
|
||||||
# undef INTERNAL_SYSCALL_ERROR_P
|
|
||||||
# define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
|
||||||
((unsigned long) (val) >= (unsigned long) -4095)
|
|
||||||
|
|
||||||
# undef INTERNAL_SYSCALL_ERRNO
|
|
||||||
# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
|
|
||||||
|
|
||||||
# define LOAD_ARGS_0() \
|
# define LOAD_ARGS_0() \
|
||||||
register long _x0 asm ("x0");
|
register long _x0 asm ("x0");
|
||||||
# define LOAD_ARGS_1(x0) \
|
# define LOAD_ARGS_1(x0) \
|
||||||
|
@ -21,8 +21,7 @@
|
|||||||
break value (instead of the new, requested one). */
|
break value (instead of the new, requested one). */
|
||||||
|
|
||||||
#include <sysdep.h>
|
#include <sysdep.h>
|
||||||
#define _ERRNO_H
|
#include <errno.h>
|
||||||
#include <bits/errno.h>
|
|
||||||
|
|
||||||
#ifdef PIC
|
#ifdef PIC
|
||||||
.section .bss
|
.section .bss
|
||||||
|
@ -92,6 +92,7 @@
|
|||||||
# define USEPV_PROF no
|
# define USEPV_PROF no
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#undef SYSCALL_ERROR_LABEL
|
||||||
#if RTLD_PRIVATE_ERRNO
|
#if RTLD_PRIVATE_ERRNO
|
||||||
# define SYSCALL_ERROR_LABEL $syscall_error
|
# define SYSCALL_ERROR_LABEL $syscall_error
|
||||||
# define SYSCALL_ERROR_HANDLER \
|
# define SYSCALL_ERROR_HANDLER \
|
||||||
@ -169,42 +170,18 @@ __LABEL(name) \
|
|||||||
|
|
||||||
#else /* !ASSEMBLER */
|
#else /* !ASSEMBLER */
|
||||||
|
|
||||||
/* In order to get __set_errno() definition in INLINE_SYSCALL. */
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#undef INLINE_SYSCALL
|
|
||||||
#define INLINE_SYSCALL(name, nr, args...) \
|
|
||||||
({ \
|
|
||||||
INTERNAL_SYSCALL_DECL (_sc_err); \
|
|
||||||
long int _sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \
|
|
||||||
if (INTERNAL_SYSCALL_ERROR_P (_sc_ret, _sc_err)) \
|
|
||||||
{ \
|
|
||||||
__set_errno (INTERNAL_SYSCALL_ERRNO (_sc_ret, _sc_err)); \
|
|
||||||
_sc_ret = -1L; \
|
|
||||||
} \
|
|
||||||
_sc_ret; \
|
|
||||||
})
|
|
||||||
|
|
||||||
#define INTERNAL_SYSCALL(name, err_out, nr, args...) \
|
#define INTERNAL_SYSCALL(name, err_out, nr, args...) \
|
||||||
internal_syscall##nr(__NR_##name, args)
|
internal_syscall##nr(__NR_##name, args)
|
||||||
|
|
||||||
#define INTERNAL_SYSCALL_NCS(name, err_out, nr, args...) \
|
#define INTERNAL_SYSCALL_NCS(name, err_out, nr, args...) \
|
||||||
internal_syscall##nr(name, args)
|
internal_syscall##nr(name, args)
|
||||||
|
|
||||||
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
|
|
||||||
|
|
||||||
/* The normal Alpha calling convention sign-extends 32-bit quantties
|
/* The normal Alpha calling convention sign-extends 32-bit quantties
|
||||||
no matter what the "real" sign of the 32-bit type. We want to
|
no matter what the "real" sign of the 32-bit type. We want to
|
||||||
preserve that when filling in values for the kernel. */
|
preserve that when filling in values for the kernel. */
|
||||||
#define syscall_promote(arg) \
|
#define syscall_promote(arg) \
|
||||||
(sizeof (arg) == 4 ? (long int)(int)(long int)(arg) : (long int)(arg))
|
(sizeof (arg) == 4 ? (long int)(int)(long int)(arg) : (long int)(arg))
|
||||||
|
|
||||||
/* Make sure and "use" the variable that we're not returning,
|
|
||||||
in order to suppress unused variable warnings. */
|
|
||||||
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
|
||||||
((unsigned long) (val) > -4096UL)
|
|
||||||
#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
|
|
||||||
|
|
||||||
#define internal_syscall_clobbers \
|
#define internal_syscall_clobbers \
|
||||||
"$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \
|
"$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \
|
||||||
"$22", "$23", "$24", "$25", "$27", "$28", "memory"
|
"$22", "$23", "$24", "$25", "$27", "$28", "memory"
|
||||||
|
@ -29,11 +29,6 @@
|
|||||||
|
|
||||||
#include <tls.h>
|
#include <tls.h>
|
||||||
|
|
||||||
/* In order to get __set_errno() definition in INLINE_SYSCALL. */
|
|
||||||
#ifndef __ASSEMBLER__
|
|
||||||
#include <errno.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* For Linux we can use the system call table in the header file
|
/* For Linux we can use the system call table in the header file
|
||||||
/usr/include/asm/unistd.h
|
/usr/include/asm/unistd.h
|
||||||
of the kernel. But these symbols do not follow the SYS_* syntax
|
of the kernel. But these symbols do not follow the SYS_* syntax
|
||||||
@ -317,21 +312,6 @@ __local_syscall_error: \
|
|||||||
|
|
||||||
#else /* not __ASSEMBLER__ */
|
#else /* not __ASSEMBLER__ */
|
||||||
|
|
||||||
/* Define a macro which expands into the inline wrapper code for a system
|
|
||||||
call. */
|
|
||||||
#undef INLINE_SYSCALL
|
|
||||||
#define INLINE_SYSCALL(name, nr, args...) \
|
|
||||||
({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args); \
|
|
||||||
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0)) \
|
|
||||||
{ \
|
|
||||||
__set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \
|
|
||||||
_sys_result = (unsigned int) -1; \
|
|
||||||
} \
|
|
||||||
(int) _sys_result; })
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_DECL
|
|
||||||
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
|
|
||||||
|
|
||||||
#if defined(__thumb__)
|
#if defined(__thumb__)
|
||||||
/* We can not expose the use of r7 to the compiler. GCC (as
|
/* We can not expose the use of r7 to the compiler. GCC (as
|
||||||
of 4.5) uses r7 as the hard frame pointer for Thumb - although
|
of 4.5) uses r7 as the hard frame pointer for Thumb - although
|
||||||
@ -377,13 +357,6 @@ __local_syscall_error: \
|
|||||||
#define INTERNAL_SYSCALL(name, err, nr, args...) \
|
#define INTERNAL_SYSCALL(name, err, nr, args...) \
|
||||||
INTERNAL_SYSCALL_RAW(SYS_ify(name), err, nr, args)
|
INTERNAL_SYSCALL_RAW(SYS_ify(name), err, nr, args)
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERROR_P
|
|
||||||
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
|
||||||
((unsigned int) (val) >= 0xfffff001u)
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERRNO
|
|
||||||
#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
|
|
||||||
|
|
||||||
#define VDSO_NAME "LINUX_2.6"
|
#define VDSO_NAME "LINUX_2.6"
|
||||||
#define VDSO_HASH 61765110
|
#define VDSO_HASH 61765110
|
||||||
|
|
||||||
|
@ -293,28 +293,6 @@ __local_syscall_error: \
|
|||||||
|
|
||||||
#else /* not __ASSEMBLER__ */
|
#else /* not __ASSEMBLER__ */
|
||||||
|
|
||||||
/* Define a macro which expands into the inline wrapper code for a system
|
|
||||||
call. */
|
|
||||||
# undef INLINE_SYSCALL
|
|
||||||
# define INLINE_SYSCALL(name, nr, args...) \
|
|
||||||
({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args); \
|
|
||||||
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result,), 0)) \
|
|
||||||
{ \
|
|
||||||
__set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \
|
|
||||||
_sys_result = (unsigned int) -1; \
|
|
||||||
} \
|
|
||||||
(int) _sys_result; })
|
|
||||||
|
|
||||||
# undef INTERNAL_SYSCALL_DECL
|
|
||||||
# define INTERNAL_SYSCALL_DECL(err) do { } while (0)
|
|
||||||
|
|
||||||
# undef INTERNAL_SYSCALL_ERROR_P
|
|
||||||
# define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
|
||||||
((unsigned int) (val) >= 0xffffff01u)
|
|
||||||
|
|
||||||
# undef INTERNAL_SYSCALL_ERRNO
|
|
||||||
# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
|
|
||||||
|
|
||||||
# undef INTERNAL_SYSCALL_RAW
|
# undef INTERNAL_SYSCALL_RAW
|
||||||
# define INTERNAL_SYSCALL_RAW0(name, err, dummy...) \
|
# define INTERNAL_SYSCALL_RAW0(name, err, dummy...) \
|
||||||
({unsigned int __sys_result; \
|
({unsigned int __sys_result; \
|
||||||
|
@ -360,36 +360,6 @@ L(pre_end): ASM_LINE_SEP \
|
|||||||
#define CALL_CLOB_REGS "%r1", "%r2", CLOB_TREG \
|
#define CALL_CLOB_REGS "%r1", "%r2", CLOB_TREG \
|
||||||
"%r20", "%r29", "%r31"
|
"%r20", "%r29", "%r31"
|
||||||
|
|
||||||
#undef INLINE_SYSCALL
|
|
||||||
#define INLINE_SYSCALL(name, nr, args...) \
|
|
||||||
({ \
|
|
||||||
long __sys_res = INTERNAL_SYSCALL (name, , nr, args); \
|
|
||||||
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (__sys_res, ))) \
|
|
||||||
{ \
|
|
||||||
__set_errno (INTERNAL_SYSCALL_ERRNO (__sys_res, )); \
|
|
||||||
__sys_res = -1; \
|
|
||||||
} \
|
|
||||||
__sys_res; \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* INTERNAL_SYSCALL_DECL - Allows us to setup some function static
|
|
||||||
value to use within the context of the syscall
|
|
||||||
INTERNAL_SYSCALL_ERROR_P - Returns 0 if it wasn't an error, 1 otherwise
|
|
||||||
You are allowed to use the syscall result (val) and the DECL error
|
|
||||||
variable to determine what went wrong.
|
|
||||||
INTERLAL_SYSCALL_ERRNO - Munges the val/err pair into the error number.
|
|
||||||
In our case we just flip the sign. */
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_DECL
|
|
||||||
#define INTERNAL_SYSCALL_DECL(err)
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERROR_P
|
|
||||||
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
|
||||||
((val < 0) && (val > -4095))
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERRNO
|
|
||||||
#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
|
|
||||||
|
|
||||||
/* Similar to INLINE_SYSCALL but we don't set errno */
|
/* Similar to INLINE_SYSCALL but we don't set errno */
|
||||||
#undef INTERNAL_SYSCALL
|
#undef INTERNAL_SYSCALL
|
||||||
#define INTERNAL_SYSCALL(name, err, nr, args...) \
|
#define INTERNAL_SYSCALL(name, err, nr, args...) \
|
||||||
|
@ -67,6 +67,7 @@
|
|||||||
|
|
||||||
/* We don't want the label for the error handle to be global when we define
|
/* We don't want the label for the error handle to be global when we define
|
||||||
it here. */
|
it here. */
|
||||||
|
#undef SYSCALL_ERROR_LABEL
|
||||||
#define SYSCALL_ERROR_LABEL __syscall_error
|
#define SYSCALL_ERROR_LABEL __syscall_error
|
||||||
|
|
||||||
#undef PSEUDO
|
#undef PSEUDO
|
||||||
@ -280,35 +281,6 @@ struct libc_do_syscall_args
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Define a macro which expands inline into the wrapper code for a system
|
|
||||||
call. */
|
|
||||||
#undef INLINE_SYSCALL
|
|
||||||
#if IS_IN (libc)
|
|
||||||
# define INLINE_SYSCALL(name, nr, args...) \
|
|
||||||
({ \
|
|
||||||
unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \
|
|
||||||
__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, )) \
|
|
||||||
? __syscall_error (-INTERNAL_SYSCALL_ERRNO (resultvar, )) \
|
|
||||||
: (int) resultvar; })
|
|
||||||
#else
|
|
||||||
# define INLINE_SYSCALL(name, nr, args...) \
|
|
||||||
({ \
|
|
||||||
unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \
|
|
||||||
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, ))) \
|
|
||||||
{ \
|
|
||||||
__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \
|
|
||||||
resultvar = 0xffffffff; \
|
|
||||||
} \
|
|
||||||
(int) resultvar; })
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Set error number and return -1. Return the internal function,
|
|
||||||
__syscall_error, which sets errno from the negative error number
|
|
||||||
and returns -1, to avoid PIC. */
|
|
||||||
#undef INLINE_SYSCALL_ERROR_RETURN_VALUE
|
|
||||||
#define INLINE_SYSCALL_ERROR_RETURN_VALUE(resultvar) \
|
|
||||||
__syscall_error (-(resultvar))
|
|
||||||
|
|
||||||
# define VDSO_NAME "LINUX_2.6"
|
# define VDSO_NAME "LINUX_2.6"
|
||||||
# define VDSO_HASH 61765110
|
# define VDSO_HASH 61765110
|
||||||
|
|
||||||
@ -490,16 +462,6 @@ struct libc_do_syscall_args
|
|||||||
# endif /* GCC 5 */
|
# endif /* GCC 5 */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_DECL
|
|
||||||
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERROR_P
|
|
||||||
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
|
||||||
((unsigned int) (val) >= 0xfffff001u)
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERRNO
|
|
||||||
#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
|
|
||||||
|
|
||||||
#define LOADARGS_0
|
#define LOADARGS_0
|
||||||
#ifdef __PIC__
|
#ifdef __PIC__
|
||||||
# if I386_USE_SYSENTER && defined PIC
|
# if I386_USE_SYSENTER && defined PIC
|
||||||
|
@ -95,6 +95,7 @@
|
|||||||
|
|
||||||
/* We don't want the label for the error handler to be visible in the symbol
|
/* We don't want the label for the error handler to be visible in the symbol
|
||||||
table when we define it here. */
|
table when we define it here. */
|
||||||
|
#undef SYSCALL_ERROR_LABEL
|
||||||
#define SYSCALL_ERROR_LABEL __syscall_error
|
#define SYSCALL_ERROR_LABEL __syscall_error
|
||||||
|
|
||||||
#undef PSEUDO
|
#undef PSEUDO
|
||||||
@ -231,29 +232,9 @@
|
|||||||
|
|
||||||
#endif /* !IA64_USE_NEW_STUB */
|
#endif /* !IA64_USE_NEW_STUB */
|
||||||
|
|
||||||
# undef INLINE_SYSCALL
|
|
||||||
# define INLINE_SYSCALL(name, nr, args...) \
|
|
||||||
({ unsigned long _sys_result = INTERNAL_SYSCALL (name, , nr, args); \
|
|
||||||
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\
|
|
||||||
{ \
|
|
||||||
__set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \
|
|
||||||
_sys_result = (unsigned long) -1; \
|
|
||||||
} \
|
|
||||||
(long) _sys_result; })
|
|
||||||
|
|
||||||
# undef INTERNAL_SYSCALL_DECL
|
|
||||||
# define INTERNAL_SYSCALL_DECL(err) do { } while (0)
|
|
||||||
|
|
||||||
#define INTERNAL_SYSCALL(name, err, nr, args...) \
|
#define INTERNAL_SYSCALL(name, err, nr, args...) \
|
||||||
INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)
|
INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERROR_P
|
|
||||||
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
|
||||||
((unsigned long int) (val) > -4096UL)
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERRNO
|
|
||||||
#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
|
|
||||||
|
|
||||||
#define LOAD_ARGS_0()
|
#define LOAD_ARGS_0()
|
||||||
#define LOAD_REGS_0
|
#define LOAD_REGS_0
|
||||||
#define LOAD_ARGS_1(a1) \
|
#define LOAD_ARGS_1(a1) \
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
|
|
||||||
/* We don't want the label for the error handler to be visible in the symbol
|
/* We don't want the label for the error handler to be visible in the symbol
|
||||||
table when we define it here. */
|
table when we define it here. */
|
||||||
|
#undef SYSCALL_ERROR_LABEL
|
||||||
#ifdef PIC
|
#ifdef PIC
|
||||||
#define SYSCALL_ERROR_LABEL .Lsyscall_error
|
#define SYSCALL_ERROR_LABEL .Lsyscall_error
|
||||||
#else
|
#else
|
||||||
@ -221,21 +222,6 @@ SYSCALL_ERROR_LABEL: \
|
|||||||
|
|
||||||
#else /* not __ASSEMBLER__ */
|
#else /* not __ASSEMBLER__ */
|
||||||
|
|
||||||
/* Define a macro which expands into the inline wrapper code for a system
|
|
||||||
call. */
|
|
||||||
#undef INLINE_SYSCALL
|
|
||||||
#define INLINE_SYSCALL(name, nr, args...) \
|
|
||||||
({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args); \
|
|
||||||
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\
|
|
||||||
{ \
|
|
||||||
__set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \
|
|
||||||
_sys_result = (unsigned int) -1; \
|
|
||||||
} \
|
|
||||||
(int) _sys_result; })
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_DECL
|
|
||||||
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
|
|
||||||
|
|
||||||
/* Define a macro which expands inline into the wrapper code for a system
|
/* Define a macro which expands inline into the wrapper code for a system
|
||||||
call. This use is for internal calls that do not need to handle errors
|
call. This use is for internal calls that do not need to handle errors
|
||||||
normally. It will never touch errno. This returns just what the kernel
|
normally. It will never touch errno. This returns just what the kernel
|
||||||
@ -260,13 +246,6 @@ SYSCALL_ERROR_LABEL: \
|
|||||||
#define INTERNAL_SYSCALL(name, err, nr, args...) \
|
#define INTERNAL_SYSCALL(name, err, nr, args...) \
|
||||||
INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)
|
INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERROR_P
|
|
||||||
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
|
||||||
((unsigned int) (val) >= -4095U)
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERRNO
|
|
||||||
#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
|
|
||||||
|
|
||||||
#define LOAD_ARGS_0()
|
#define LOAD_ARGS_0()
|
||||||
#define LOAD_REGS_0
|
#define LOAD_REGS_0
|
||||||
#define ASM_ARGS_0
|
#define ASM_ARGS_0
|
||||||
|
@ -60,6 +60,7 @@
|
|||||||
|
|
||||||
/* We don't want the label for the error handler to be visible in the symbol
|
/* We don't want the label for the error handler to be visible in the symbol
|
||||||
table when we define it here. */
|
table when we define it here. */
|
||||||
|
# undef SYSCALL_ERROR_LABEL
|
||||||
# ifdef PIC
|
# ifdef PIC
|
||||||
# define SYSCALL_ERROR_LABEL 0f
|
# define SYSCALL_ERROR_LABEL 0f
|
||||||
# else
|
# else
|
||||||
@ -163,23 +164,6 @@ SYSCALL_ERROR_LABEL_DCL: \
|
|||||||
|
|
||||||
#else /* not __ASSEMBLER__ */
|
#else /* not __ASSEMBLER__ */
|
||||||
|
|
||||||
/* Define a macro which expands into the inline wrapper code for a system
|
|
||||||
call. */
|
|
||||||
# undef INLINE_SYSCALL
|
|
||||||
# define INLINE_SYSCALL(name, nr, args...) \
|
|
||||||
({ INTERNAL_SYSCALL_DECL(err); \
|
|
||||||
unsigned long resultvar = INTERNAL_SYSCALL(name, err, nr, args); \
|
|
||||||
if (INTERNAL_SYSCALL_ERROR_P (resultvar, err)) \
|
|
||||||
{ \
|
|
||||||
__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, err)); \
|
|
||||||
resultvar = (unsigned long) -1; \
|
|
||||||
} \
|
|
||||||
(long) resultvar; \
|
|
||||||
})
|
|
||||||
|
|
||||||
# undef INTERNAL_SYSCALL_DECL
|
|
||||||
# define INTERNAL_SYSCALL_DECL(err) do { } while (0)
|
|
||||||
|
|
||||||
/* Define a macro which expands inline into the wrapper code for a system
|
/* Define a macro which expands inline into the wrapper code for a system
|
||||||
call. This use is for internal calls that do not need to handle errors
|
call. This use is for internal calls that do not need to handle errors
|
||||||
normally. It will never touch errno. This returns just what the kernel
|
normally. It will never touch errno. This returns just what the kernel
|
||||||
@ -192,13 +176,6 @@ SYSCALL_ERROR_LABEL_DCL: \
|
|||||||
# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
|
# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
|
||||||
inline_syscall##nr(name, args)
|
inline_syscall##nr(name, args)
|
||||||
|
|
||||||
# undef INTERNAL_SYSCALL_ERROR_P
|
|
||||||
# define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
|
||||||
((unsigned int) (val) >= -4095U)
|
|
||||||
|
|
||||||
# undef INTERNAL_SYSCALL_ERRNO
|
|
||||||
# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
|
|
||||||
|
|
||||||
# define SYSCALL_CLOBBERS_6 "r11", "r4", "memory"
|
# define SYSCALL_CLOBBERS_6 "r11", "r4", "memory"
|
||||||
# define SYSCALL_CLOBBERS_5 "r10", SYSCALL_CLOBBERS_6
|
# define SYSCALL_CLOBBERS_5 "r10", SYSCALL_CLOBBERS_6
|
||||||
# define SYSCALL_CLOBBERS_4 "r9", SYSCALL_CLOBBERS_5
|
# define SYSCALL_CLOBBERS_4 "r9", SYSCALL_CLOBBERS_5
|
||||||
|
@ -25,11 +25,6 @@
|
|||||||
|
|
||||||
#include <tls.h>
|
#include <tls.h>
|
||||||
|
|
||||||
/* In order to get __set_errno() definition in INLINE_SYSCALL. */
|
|
||||||
#ifndef __ASSEMBLER__
|
|
||||||
#include <errno.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* For Linux we can use the system call table in the header file
|
/* For Linux we can use the system call table in the header file
|
||||||
/usr/include/asm/unistd.h
|
/usr/include/asm/unistd.h
|
||||||
of the kernel. But these symbols do not follow the SYS_* syntax
|
of the kernel. But these symbols do not follow the SYS_* syntax
|
||||||
@ -42,34 +37,12 @@
|
|||||||
/* We don't want the label for the error handler to be visible in the symbol
|
/* We don't want the label for the error handler to be visible in the symbol
|
||||||
table when we define it here. */
|
table when we define it here. */
|
||||||
#ifdef __PIC__
|
#ifdef __PIC__
|
||||||
|
# undef SYSCALL_ERROR_LABEL
|
||||||
# define SYSCALL_ERROR_LABEL 99b
|
# define SYSCALL_ERROR_LABEL 99b
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else /* ! __ASSEMBLER__ */
|
#else /* ! __ASSEMBLER__ */
|
||||||
|
|
||||||
/* Define a macro which expands into the inline wrapper code for a system
|
|
||||||
call. */
|
|
||||||
#undef INLINE_SYSCALL
|
|
||||||
#define INLINE_SYSCALL(name, nr, args...) \
|
|
||||||
({ INTERNAL_SYSCALL_DECL (_sc_err); \
|
|
||||||
long int result_var = INTERNAL_SYSCALL (name, _sc_err, nr, args); \
|
|
||||||
if ( INTERNAL_SYSCALL_ERROR_P (result_var, _sc_err) ) \
|
|
||||||
{ \
|
|
||||||
__set_errno (INTERNAL_SYSCALL_ERRNO (result_var, _sc_err)); \
|
|
||||||
result_var = -1L; \
|
|
||||||
} \
|
|
||||||
result_var; })
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_DECL
|
|
||||||
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERROR_P
|
|
||||||
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
|
||||||
((unsigned long int) (val) > -4096UL)
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERRNO
|
|
||||||
#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
|
|
||||||
|
|
||||||
/* Note that the original Linux syscall restart convention required the
|
/* Note that the original Linux syscall restart convention required the
|
||||||
instruction immediately preceding SYSCALL to initialize $v0 with the
|
instruction immediately preceding SYSCALL to initialize $v0 with the
|
||||||
syscall number. Then if a restart triggered, $v0 would have been
|
syscall number. Then if a restart triggered, $v0 would have been
|
||||||
|
@ -25,11 +25,6 @@
|
|||||||
|
|
||||||
#include <tls.h>
|
#include <tls.h>
|
||||||
|
|
||||||
/* In order to get __set_errno() definition in INLINE_SYSCALL. */
|
|
||||||
#ifndef __ASSEMBLER__
|
|
||||||
#include <errno.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* For Linux we can use the system call table in the header file
|
/* For Linux we can use the system call table in the header file
|
||||||
/usr/include/asm/unistd.h
|
/usr/include/asm/unistd.h
|
||||||
of the kernel. But these symbols do not follow the SYS_* syntax
|
of the kernel. But these symbols do not follow the SYS_* syntax
|
||||||
@ -41,6 +36,7 @@
|
|||||||
|
|
||||||
/* We don't want the label for the error handler to be visible in the symbol
|
/* We don't want the label for the error handler to be visible in the symbol
|
||||||
table when we define it here. */
|
table when we define it here. */
|
||||||
|
# undef SYSCALL_ERROR_LABEL
|
||||||
# define SYSCALL_ERROR_LABEL 99b
|
# define SYSCALL_ERROR_LABEL 99b
|
||||||
|
|
||||||
#else /* ! __ASSEMBLER__ */
|
#else /* ! __ASSEMBLER__ */
|
||||||
@ -55,29 +51,6 @@ typedef long long int __syscall_arg_t;
|
|||||||
typedef long int __syscall_arg_t;
|
typedef long int __syscall_arg_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Define a macro which expands into the inline wrapper code for a system
|
|
||||||
call. */
|
|
||||||
#undef INLINE_SYSCALL
|
|
||||||
#define INLINE_SYSCALL(name, nr, args...) \
|
|
||||||
({ INTERNAL_SYSCALL_DECL (_sc_err); \
|
|
||||||
long int result_var = INTERNAL_SYSCALL (name, _sc_err, nr, args); \
|
|
||||||
if ( INTERNAL_SYSCALL_ERROR_P (result_var, _sc_err) ) \
|
|
||||||
{ \
|
|
||||||
__set_errno (INTERNAL_SYSCALL_ERRNO (result_var, _sc_err)); \
|
|
||||||
result_var = -1L; \
|
|
||||||
} \
|
|
||||||
result_var; })
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_DECL
|
|
||||||
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERROR_P
|
|
||||||
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
|
||||||
((unsigned long int) (val) > -4096UL)
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERRNO
|
|
||||||
#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
|
|
||||||
|
|
||||||
/* Note that the original Linux syscall restart convention required the
|
/* Note that the original Linux syscall restart convention required the
|
||||||
instruction immediately preceding SYSCALL to initialize $v0 with the
|
instruction immediately preceding SYSCALL to initialize $v0 with the
|
||||||
syscall number. Then if a restart triggered, $v0 would have been
|
syscall number. Then if a restart triggered, $v0 would have been
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
#ifdef __ASSEMBLER__
|
#ifdef __ASSEMBLER__
|
||||||
|
|
||||||
|
#undef SYSCALL_ERROR_LABEL
|
||||||
#define SYSCALL_ERROR_LABEL __local_syscall_error
|
#define SYSCALL_ERROR_LABEL __local_syscall_error
|
||||||
|
|
||||||
#undef PSEUDO
|
#undef PSEUDO
|
||||||
@ -143,29 +144,6 @@
|
|||||||
which lead in a non existent __send symbol in libc.so. */
|
which lead in a non existent __send symbol in libc.so. */
|
||||||
# undef HAVE_INTERNAL_SEND_SYMBOL
|
# undef HAVE_INTERNAL_SEND_SYMBOL
|
||||||
|
|
||||||
/* Define a macro which expands into the inline wrapper code for a system
|
|
||||||
call. */
|
|
||||||
#undef INLINE_SYSCALL
|
|
||||||
#define INLINE_SYSCALL(name, nr, args...) \
|
|
||||||
({ INTERNAL_SYSCALL_DECL(err); \
|
|
||||||
unsigned int result_var = INTERNAL_SYSCALL (name, err, nr, args); \
|
|
||||||
if ( INTERNAL_SYSCALL_ERROR_P (result_var, err) ) \
|
|
||||||
{ \
|
|
||||||
__set_errno (INTERNAL_SYSCALL_ERRNO (result_var, err)); \
|
|
||||||
result_var = -1L; \
|
|
||||||
} \
|
|
||||||
(int) result_var; })
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_DECL
|
|
||||||
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERROR_P
|
|
||||||
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
|
||||||
((unsigned long int) (val) > -4096UL)
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERRNO
|
|
||||||
#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_RAW
|
#undef INTERNAL_SYSCALL_RAW
|
||||||
#define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \
|
#define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \
|
||||||
({ unsigned int _sys_result; \
|
({ unsigned int _sys_result; \
|
||||||
|
@ -64,26 +64,6 @@
|
|||||||
#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \
|
#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \
|
||||||
INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, long int, nr, args)
|
INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, long int, nr, args)
|
||||||
|
|
||||||
/* This version is for kernels that implement system calls that
|
|
||||||
behave like function calls as far as register saving. */
|
|
||||||
#undef INLINE_SYSCALL
|
|
||||||
#define INLINE_SYSCALL(name, nr, args...) \
|
|
||||||
({ \
|
|
||||||
INTERNAL_SYSCALL_DECL (sc_err); \
|
|
||||||
long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \
|
|
||||||
if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
|
|
||||||
{ \
|
|
||||||
__set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \
|
|
||||||
sc_ret = -1L; \
|
|
||||||
} \
|
|
||||||
sc_ret; \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* Define a macro which expands inline into the wrapper code for a system
|
|
||||||
call. This use is for internal calls that do not need to handle errors
|
|
||||||
normally. It will never touch errno. This returns just what the kernel
|
|
||||||
gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set)
|
|
||||||
the negation of the return value in the kernel gets reverted. */
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL
|
#undef INTERNAL_SYSCALL
|
||||||
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
|
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
|
||||||
@ -111,16 +91,6 @@
|
|||||||
#define INTERNAL_SYSCALL(name, err, nr, args...) \
|
#define INTERNAL_SYSCALL(name, err, nr, args...) \
|
||||||
INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, args)
|
INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, args)
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_DECL
|
|
||||||
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERROR_P
|
|
||||||
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
|
||||||
((unsigned long int) (val) > -4096UL)
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERRNO
|
|
||||||
#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
|
|
||||||
|
|
||||||
#if defined(__PPC64__) || defined(__powerpc64__)
|
#if defined(__PPC64__) || defined(__powerpc64__)
|
||||||
# define SYSCALL_ARG_SIZE 8
|
# define SYSCALL_ARG_SIZE 8
|
||||||
#else
|
#else
|
||||||
|
@ -130,26 +130,6 @@
|
|||||||
# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
|
# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
|
||||||
# define HAVE_GETCPU_VSYSCALL "__vdso_getcpu"
|
# define HAVE_GETCPU_VSYSCALL "__vdso_getcpu"
|
||||||
|
|
||||||
/* Define a macro which expands into the inline wrapper code for a system
|
|
||||||
call. */
|
|
||||||
# undef INLINE_SYSCALL
|
|
||||||
# define INLINE_SYSCALL(name, nr, args...) \
|
|
||||||
({ INTERNAL_SYSCALL_DECL (err); \
|
|
||||||
long int __sys_result = INTERNAL_SYSCALL (name, err, nr, args); \
|
|
||||||
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (__sys_result, ))) \
|
|
||||||
{ \
|
|
||||||
__set_errno (INTERNAL_SYSCALL_ERRNO (__sys_result, )); \
|
|
||||||
__sys_result = (unsigned long) -1; \
|
|
||||||
} \
|
|
||||||
__sys_result; })
|
|
||||||
|
|
||||||
# define INTERNAL_SYSCALL_DECL(err) do { } while (0)
|
|
||||||
|
|
||||||
# define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
|
||||||
((unsigned long int) (val) > -4096UL)
|
|
||||||
|
|
||||||
# define INTERNAL_SYSCALL_ERRNO(val, err) (-val)
|
|
||||||
|
|
||||||
# define INTERNAL_SYSCALL(name, err, nr, args...) \
|
# define INTERNAL_SYSCALL(name, err, nr, args...) \
|
||||||
internal_syscall##nr (SYS_ify (name), err, args)
|
internal_syscall##nr (SYS_ify (name), err, args)
|
||||||
|
|
||||||
|
@ -26,11 +26,6 @@
|
|||||||
#include <dl-sysdep.h> /* For RTLD_PRIVATE_ERRNO. */
|
#include <dl-sysdep.h> /* For RTLD_PRIVATE_ERRNO. */
|
||||||
#include <tls.h>
|
#include <tls.h>
|
||||||
|
|
||||||
/* Define __set_errno() for INLINE_SYSCALL macro below. */
|
|
||||||
#ifndef __ASSEMBLER__
|
|
||||||
#include <errno.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* For Linux we can use the system call table in the header file
|
/* For Linux we can use the system call table in the header file
|
||||||
/usr/include/asm/unistd.h
|
/usr/include/asm/unistd.h
|
||||||
of the kernel. But these symbols do not follow the SYS_* syntax
|
of the kernel. But these symbols do not follow the SYS_* syntax
|
||||||
@ -85,6 +80,7 @@
|
|||||||
#define PSEUDO_END_ERRVAL(name) \
|
#define PSEUDO_END_ERRVAL(name) \
|
||||||
END (name)
|
END (name)
|
||||||
|
|
||||||
|
#undef SYSCALL_ERROR_LABEL
|
||||||
#ifndef PIC
|
#ifndef PIC
|
||||||
# define SYSCALL_ERROR_LABEL 0f
|
# define SYSCALL_ERROR_LABEL 0f
|
||||||
# define SYSCALL_ERROR_HANDLER \
|
# define SYSCALL_ERROR_HANDLER \
|
||||||
|
@ -27,11 +27,6 @@
|
|||||||
#include <dl-sysdep.h> /* For RTLD_PRIVATE_ERRNO. */
|
#include <dl-sysdep.h> /* For RTLD_PRIVATE_ERRNO. */
|
||||||
#include <tls.h>
|
#include <tls.h>
|
||||||
|
|
||||||
/* Define __set_errno() for INLINE_SYSCALL macro below. */
|
|
||||||
#ifndef __ASSEMBLER__
|
|
||||||
#include <errno.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* For Linux we can use the system call table in the header file
|
/* For Linux we can use the system call table in the header file
|
||||||
/usr/include/asm/unistd.h
|
/usr/include/asm/unistd.h
|
||||||
of the kernel. But these symbols do not follow the SYS_* syntax
|
of the kernel. But these symbols do not follow the SYS_* syntax
|
||||||
@ -99,6 +94,7 @@
|
|||||||
SYSCALL_ERROR_HANDLER; \
|
SYSCALL_ERROR_HANDLER; \
|
||||||
END (name)
|
END (name)
|
||||||
|
|
||||||
|
#undef SYSCALL_ERROR_LABEL
|
||||||
#ifndef PIC
|
#ifndef PIC
|
||||||
# define SYSCALL_ERROR_LABEL syscall_error
|
# define SYSCALL_ERROR_LABEL syscall_error
|
||||||
# define SYSCALL_ERROR_HANDLER
|
# define SYSCALL_ERROR_HANDLER
|
||||||
|
@ -21,20 +21,6 @@
|
|||||||
#undef SYS_ify
|
#undef SYS_ify
|
||||||
#define SYS_ify(syscall_name) __NR_##syscall_name
|
#define SYS_ify(syscall_name) __NR_##syscall_name
|
||||||
|
|
||||||
#undef INLINE_SYSCALL
|
|
||||||
#define INLINE_SYSCALL(name, nr, args...) \
|
|
||||||
({ \
|
|
||||||
long int _ret = INTERNAL_SYSCALL (name, , nr, args); \
|
|
||||||
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (_ret, ))) \
|
|
||||||
{ \
|
|
||||||
__set_errno (INTERNAL_SYSCALL_ERRNO (_ret, )); \
|
|
||||||
_ret = -1; \
|
|
||||||
} \
|
|
||||||
_ret; })
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_DECL
|
|
||||||
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_DIRECT
|
#undef INTERNAL_SYSCALL_DIRECT
|
||||||
#define INTERNAL_SYSCALL_DIRECT(name, err, nr, args...) \
|
#define INTERNAL_SYSCALL_DIRECT(name, err, nr, args...) \
|
||||||
({ \
|
({ \
|
||||||
@ -80,13 +66,6 @@
|
|||||||
? INTERNAL_SYSCALL_DIRECT(name, nr, args) \
|
? INTERNAL_SYSCALL_DIRECT(name, nr, args) \
|
||||||
: INTERNAL_SYSCALL_SVC0(name, nr, args))
|
: INTERNAL_SYSCALL_SVC0(name, nr, args))
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERROR_P
|
|
||||||
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
|
||||||
((unsigned long int) (val) > -4096UL)
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERRNO
|
|
||||||
#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
|
|
||||||
|
|
||||||
#define DECLARGS_0()
|
#define DECLARGS_0()
|
||||||
#define DECLARGS_1(arg1) \
|
#define DECLARGS_1(arg1) \
|
||||||
register unsigned long int gpr2 __asm__ ("2") = (unsigned long int)(arg1);
|
register unsigned long int gpr2 __asm__ ("2") = (unsigned long int)(arg1);
|
||||||
|
@ -287,17 +287,6 @@
|
|||||||
register long int r1 asm ("%r1") = (long int) (_arg6); \
|
register long int r1 asm ("%r1") = (long int) (_arg6); \
|
||||||
register long int r2 asm ("%r2") = (long int) (_arg7)
|
register long int r2 asm ("%r2") = (long int) (_arg7)
|
||||||
|
|
||||||
#undef INLINE_SYSCALL
|
|
||||||
#define INLINE_SYSCALL(name, nr, args...) \
|
|
||||||
({ \
|
|
||||||
unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \
|
|
||||||
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0)) \
|
|
||||||
{ \
|
|
||||||
__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \
|
|
||||||
resultvar = 0xffffffff; \
|
|
||||||
} \
|
|
||||||
(int) resultvar; })
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL
|
#undef INTERNAL_SYSCALL
|
||||||
#define INTERNAL_SYSCALL(name, err, nr, args...) \
|
#define INTERNAL_SYSCALL(name, err, nr, args...) \
|
||||||
({ \
|
({ \
|
||||||
@ -326,16 +315,6 @@
|
|||||||
\
|
\
|
||||||
(int) resultvar; })
|
(int) resultvar; })
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_DECL
|
|
||||||
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERROR_P
|
|
||||||
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
|
||||||
((unsigned int) (val) >= 0xfffff001u)
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERRNO
|
|
||||||
#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
|
|
||||||
|
|
||||||
#endif /* __ASSEMBLER__ */
|
#endif /* __ASSEMBLER__ */
|
||||||
|
|
||||||
/* Pointer mangling support. */
|
/* Pointer mangling support. */
|
||||||
|
@ -21,8 +21,7 @@
|
|||||||
break value (instead of the new, requested one). */
|
break value (instead of the new, requested one). */
|
||||||
|
|
||||||
#include <sysdep.h>
|
#include <sysdep.h>
|
||||||
#define _ERRNO_H
|
#include <errno.h>
|
||||||
#include <bits/errno.h>
|
|
||||||
|
|
||||||
#ifdef PIC
|
#ifdef PIC
|
||||||
.section .bss
|
.section .bss
|
||||||
|
@ -45,21 +45,6 @@
|
|||||||
# endif
|
# endif
|
||||||
# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
|
# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
|
||||||
|
|
||||||
#undef INLINE_SYSCALL
|
|
||||||
#define INLINE_SYSCALL(name, nr, args...) \
|
|
||||||
({ INTERNAL_SYSCALL_DECL(err); \
|
|
||||||
unsigned long resultvar = INTERNAL_SYSCALL(name, err, nr, args);\
|
|
||||||
if (INTERNAL_SYSCALL_ERROR_P (resultvar, err)) \
|
|
||||||
{ \
|
|
||||||
__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, err)); \
|
|
||||||
resultvar = (unsigned long) -1; \
|
|
||||||
} \
|
|
||||||
(long) resultvar; \
|
|
||||||
})
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_DECL
|
|
||||||
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL
|
#undef INTERNAL_SYSCALL
|
||||||
#define INTERNAL_SYSCALL(name, err, nr, args...) \
|
#define INTERNAL_SYSCALL(name, err, nr, args...) \
|
||||||
internal_syscall##nr(__SYSCALL_STRING, err, __NR_##name, args)
|
internal_syscall##nr(__SYSCALL_STRING, err, __NR_##name, args)
|
||||||
@ -68,13 +53,6 @@
|
|||||||
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
|
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
|
||||||
internal_syscall##nr(__SYSCALL_STRING, err, name, args)
|
internal_syscall##nr(__SYSCALL_STRING, err, name, args)
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERROR_P
|
|
||||||
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
|
||||||
((unsigned long int) (val) > -4096UL)
|
|
||||||
|
|
||||||
#undef INTERNAL_SYSCALL_ERRNO
|
|
||||||
#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
|
|
||||||
|
|
||||||
#define internal_syscall0(string,err,name,dummy...) \
|
#define internal_syscall0(string,err,name,dummy...) \
|
||||||
({ \
|
({ \
|
||||||
register long int __g1 __asm__ ("g1") = (name); \
|
register long int __g1 __asm__ ("g1") = (name); \
|
||||||
|
@ -15,8 +15,43 @@
|
|||||||
License along with the GNU C Library; if not, see
|
License along with the GNU C Library; if not, see
|
||||||
<https://www.gnu.org/licenses/>. */
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#ifndef _SYSDEP_LINUX_H
|
||||||
|
#define _SYSDEP_LINUX_H
|
||||||
|
|
||||||
#include <bits/wordsize.h>
|
#include <bits/wordsize.h>
|
||||||
#include <kernel-features.h>
|
#include <kernel-features.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#undef INTERNAL_SYSCALL_DECL
|
||||||
|
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
|
||||||
|
|
||||||
|
#undef INTERNAL_SYSCALL_ERROR_P
|
||||||
|
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
||||||
|
((unsigned long int) (val) > -4096UL)
|
||||||
|
|
||||||
|
#ifndef SYSCALL_ERROR_LABEL
|
||||||
|
# define SYSCALL_ERROR_LABEL(sc_err) \
|
||||||
|
({ \
|
||||||
|
__set_errno (sc_err); \
|
||||||
|
-1L; \
|
||||||
|
})
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define a macro which expands into the inline wrapper code for a system
|
||||||
|
call. It sets the errno and returns -1 on a failure, or the syscall
|
||||||
|
return value otherwise. */
|
||||||
|
#undef INLINE_SYSCALL
|
||||||
|
#define INLINE_SYSCALL(name, nr, args...) \
|
||||||
|
({ \
|
||||||
|
INTERNAL_SYSCALL_DECL (sc_err); \
|
||||||
|
long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \
|
||||||
|
__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
|
||||||
|
? SYSCALL_ERROR_LABEL (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)) \
|
||||||
|
: sc_ret; \
|
||||||
|
})
|
||||||
|
|
||||||
|
#undef INTERNAL_SYSCALL_ERRNO
|
||||||
|
#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
|
||||||
|
|
||||||
/* Set error number and return -1. A target may choose to return the
|
/* Set error number and return -1. A target may choose to return the
|
||||||
internal function, __syscall_error, which sets errno and returns -1.
|
internal function, __syscall_error, which sets errno and returns -1.
|
||||||
@ -66,3 +101,5 @@
|
|||||||
/* Exports the __send symbol on send.c linux implementation (some ABI have
|
/* Exports the __send symbol on send.c linux implementation (some ABI have
|
||||||
it missing due the usage of a old generic version without it). */
|
it missing due the usage of a old generic version without it). */
|
||||||
#define HAVE_INTERNAL_SEND_SYMBOL 1
|
#define HAVE_INTERNAL_SEND_SYMBOL 1
|
||||||
|
|
||||||
|
#endif /* _SYSDEP_LINUX_H */
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
|
|
||||||
/* We don't want the label for the error handle to be global when we define
|
/* We don't want the label for the error handle to be global when we define
|
||||||
it here. */
|
it here. */
|
||||||
|
# undef SYSCALL_ERROR_LABEL
|
||||||
# ifdef PIC
|
# ifdef PIC
|
||||||
# define SYSCALL_ERROR_LABEL 0f
|
# define SYSCALL_ERROR_LABEL 0f
|
||||||
# else
|
# else
|
||||||
@ -177,35 +178,6 @@
|
|||||||
# define DOARGS_6 DOARGS_5
|
# define DOARGS_6 DOARGS_5
|
||||||
|
|
||||||
#else /* !__ASSEMBLER__ */
|
#else /* !__ASSEMBLER__ */
|
||||||
/* Define a macro which expands inline into the wrapper code for a system
|
|
||||||
call. */
|
|
||||||
# undef INLINE_SYSCALL
|
|
||||||
# define INLINE_SYSCALL(name, nr, args...) \
|
|
||||||
({ \
|
|
||||||
unsigned long int resultvar = INTERNAL_SYSCALL (name, , nr, args); \
|
|
||||||
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, ))) \
|
|
||||||
{ \
|
|
||||||
__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \
|
|
||||||
resultvar = (unsigned long int) -1; \
|
|
||||||
} \
|
|
||||||
(long int) resultvar; })
|
|
||||||
|
|
||||||
/* Define a macro with explicit types for arguments, which expands inline
|
|
||||||
into the wrapper code for a system call. It should be used when size
|
|
||||||
of any argument > size of long int. */
|
|
||||||
# undef INLINE_SYSCALL_TYPES
|
|
||||||
# define INLINE_SYSCALL_TYPES(name, nr, args...) \
|
|
||||||
({ \
|
|
||||||
unsigned long int resultvar = INTERNAL_SYSCALL_TYPES (name, , nr, args); \
|
|
||||||
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, ))) \
|
|
||||||
{ \
|
|
||||||
__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \
|
|
||||||
resultvar = (unsigned long int) -1; \
|
|
||||||
} \
|
|
||||||
(long int) resultvar; })
|
|
||||||
|
|
||||||
# undef INTERNAL_SYSCALL_DECL
|
|
||||||
# define INTERNAL_SYSCALL_DECL(err) do { } while (0)
|
|
||||||
|
|
||||||
/* Registers clobbered by syscall. */
|
/* Registers clobbered by syscall. */
|
||||||
# define REGISTERS_CLOBBERED_BY_SYSCALL "cc", "r11", "cx"
|
# define REGISTERS_CLOBBERED_BY_SYSCALL "cc", "r11", "cx"
|
||||||
@ -353,12 +325,6 @@
|
|||||||
(long int) resultvar; \
|
(long int) resultvar; \
|
||||||
})
|
})
|
||||||
|
|
||||||
# undef INTERNAL_SYSCALL_ERROR_P
|
|
||||||
# define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
|
||||||
((unsigned long int) (long int) (val) >= -4095L)
|
|
||||||
|
|
||||||
# undef INTERNAL_SYSCALL_ERRNO
|
|
||||||
# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
|
|
||||||
|
|
||||||
# define VDSO_NAME "LINUX_2.6"
|
# define VDSO_NAME "LINUX_2.6"
|
||||||
# define VDSO_HASH 61765110
|
# define VDSO_HASH 61765110
|
||||||
|
@ -16,8 +16,7 @@
|
|||||||
<https://www.gnu.org/licenses/>. */
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <sysdep.h>
|
#include <sysdep.h>
|
||||||
#define _ERRNO_H
|
#include <errno.h>
|
||||||
#include <bits/errno.h>
|
|
||||||
#include <tls.h>
|
#include <tls.h>
|
||||||
|
|
||||||
#if IS_IN (rtld)
|
#if IS_IN (rtld)
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
License along with the GNU C Library; if not, see
|
License along with the GNU C Library; if not, see
|
||||||
<https://www.gnu.org/licenses/>. */
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <pthread-errnos.h>
|
|
||||||
#include <sysdep.h>
|
#include <sysdep.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
#ifdef UP
|
#ifdef UP
|
||||||
|
Reference in New Issue
Block a user