1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

linux: Remove INTERNAL_SYSCALL_DECL

With all Linux ABIs using the expected Linux kABI to indicate
syscalls errors, the INTERNAL_SYSCALL_DECL is an empty declaration
on all ports.

This patch removes the 'err' argument on INTERNAL_SYSCALL* macro
and remove the INTERNAL_SYSCALL_DECL usage.

Checked with a build against all affected ABIs.
This commit is contained in:
Adhemerval Zanella
2020-01-29 20:38:36 +00:00
parent d1aea2805d
commit bc2eb9321e
107 changed files with 424 additions and 545 deletions

View File

@ -1028,11 +1028,10 @@ setxid_signal_thread (struct xid_command *cmdp, struct pthread *t)
int val; int val;
pid_t pid = __getpid (); pid_t pid = __getpid ();
INTERNAL_SYSCALL_DECL (err); val = INTERNAL_SYSCALL_CALL (tgkill, pid, t->tid, SIGSETXID);
val = INTERNAL_SYSCALL_CALL (tgkill, err, pid, t->tid, SIGSETXID);
/* If this failed, it must have had not started yet or else exited. */ /* If this failed, it must have had not started yet or else exited. */
if (!INTERNAL_SYSCALL_ERROR_P (val, err)) if (!INTERNAL_SYSCALL_ERROR_P (val))
{ {
atomic_increment (&cmdp->cntr); atomic_increment (&cmdp->cntr);
return 1; return 1;
@ -1158,13 +1157,12 @@ __nptl_setxid (struct xid_command *cmdp)
/* This must be last, otherwise the current thread might not have /* This must be last, otherwise the current thread might not have
permissions to send SIGSETXID syscall to the other threads. */ permissions to send SIGSETXID syscall to the other threads. */
INTERNAL_SYSCALL_DECL (err); result = INTERNAL_SYSCALL_NCS (cmdp->syscall_no, 3,
result = INTERNAL_SYSCALL_NCS (cmdp->syscall_no, err, 3,
cmdp->id[0], cmdp->id[1], cmdp->id[2]); cmdp->id[0], cmdp->id[1], cmdp->id[2]);
int error = 0; int error = 0;
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err))) if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result)))
{ {
error = INTERNAL_SYSCALL_ERRNO (result, err); error = INTERNAL_SYSCALL_ERRNO (result);
__set_errno (error); __set_errno (error);
result = -1; result = -1;
} }

View File

@ -130,8 +130,7 @@ void
__nptl_set_robust (struct pthread *self) __nptl_set_robust (struct pthread *self)
{ {
#ifdef __NR_set_robust_list #ifdef __NR_set_robust_list
INTERNAL_SYSCALL_DECL (err); INTERNAL_SYSCALL_CALL (set_robust_list, &self->robust_head,
INTERNAL_SYSCALL (set_robust_list, err, 2, &self->robust_head,
sizeof (struct robust_list_head)); sizeof (struct robust_list_head));
#endif #endif
} }
@ -203,12 +202,11 @@ sighandler_setxid (int sig, siginfo_t *si, void *ctx)
|| si->si_code != SI_TKILL) || si->si_code != SI_TKILL)
return; return;
INTERNAL_SYSCALL_DECL (err); result = INTERNAL_SYSCALL_NCS (__xidcmd->syscall_no, 3, __xidcmd->id[0],
result = INTERNAL_SYSCALL_NCS (__xidcmd->syscall_no, err, 3, __xidcmd->id[0],
__xidcmd->id[1], __xidcmd->id[2]); __xidcmd->id[1], __xidcmd->id[2]);
int error = 0; int error = 0;
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err))) if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result)))
error = INTERNAL_SYSCALL_ERRNO (result, err); error = INTERNAL_SYSCALL_ERRNO (result);
__nptl_setxid_error (__xidcmd, error); __nptl_setxid_error (__xidcmd, error);
/* Reset the SETXID flag. */ /* Reset the SETXID flag. */
@ -258,10 +256,9 @@ __pthread_initialize_minimal_internal (void)
pd->robust_head.futex_offset = (offsetof (pthread_mutex_t, __data.__lock) pd->robust_head.futex_offset = (offsetof (pthread_mutex_t, __data.__lock)
- offsetof (pthread_mutex_t, - offsetof (pthread_mutex_t,
__data.__list.__next)); __data.__list.__next));
INTERNAL_SYSCALL_DECL (err); int res = INTERNAL_SYSCALL_CALL (set_robust_list, &pd->robust_head,
int res = INTERNAL_SYSCALL (set_robust_list, err, 2, &pd->robust_head,
sizeof (struct robust_list_head)); sizeof (struct robust_list_head));
if (INTERNAL_SYSCALL_ERROR_P (res, err)) if (INTERNAL_SYSCALL_ERROR_P (res))
#endif #endif
set_robust_list_not_avail (); set_robust_list_not_avail ();
} }
@ -299,11 +296,8 @@ __pthread_initialize_minimal_internal (void)
structure. It is already cleared. */ structure. It is already cleared. */
__sigaddset (&sa.sa_mask, SIGCANCEL); __sigaddset (&sa.sa_mask, SIGCANCEL);
__sigaddset (&sa.sa_mask, SIGSETXID); __sigaddset (&sa.sa_mask, SIGSETXID);
{ INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_UNBLOCK, &sa.sa_mask,
INTERNAL_SYSCALL_DECL (err);
(void) INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_UNBLOCK, &sa.sa_mask,
NULL, _NSIG / 8); NULL, _NSIG / 8);
}
/* Get the size of the static and alignment requirements for the TLS /* Get the size of the static and alignment requirements for the TLS
block. */ block. */

View File

@ -67,11 +67,10 @@ __pthread_cancel (pthread_t th)
thread as canceled. */ thread as canceled. */
pid_t pid = __getpid (); pid_t pid = __getpid ();
INTERNAL_SYSCALL_DECL (err); int val = INTERNAL_SYSCALL_CALL (tgkill, pid, pd->tid,
int val = INTERNAL_SYSCALL_CALL (tgkill, err, pid, pd->tid,
SIGCANCEL); SIGCANCEL);
if (INTERNAL_SYSCALL_ERROR_P (val, err)) if (INTERNAL_SYSCALL_ERROR_P (val))
result = INTERNAL_SYSCALL_ERRNO (val, err); result = INTERNAL_SYSCALL_ERRNO (val);
break; break;
} }

View File

@ -394,10 +394,9 @@ START_THREAD_DEFN
if (__set_robust_list_avail >= 0) if (__set_robust_list_avail >= 0)
# endif # endif
{ {
INTERNAL_SYSCALL_DECL (err);
/* This call should never fail because the initial call in init.c /* This call should never fail because the initial call in init.c
succeeded. */ succeeded. */
INTERNAL_SYSCALL (set_robust_list, err, 2, &pd->robust_head, INTERNAL_SYSCALL_CALL (set_robust_list, &pd->robust_head,
sizeof (struct robust_list_head)); sizeof (struct robust_list_head));
} }
#endif #endif
@ -407,11 +406,10 @@ START_THREAD_DEFN
cancellation signal mask. */ cancellation signal mask. */
if (__glibc_unlikely (pd->parent_cancelhandling & CANCELING_BITMASK)) if (__glibc_unlikely (pd->parent_cancelhandling & CANCELING_BITMASK))
{ {
INTERNAL_SYSCALL_DECL (err);
sigset_t mask; sigset_t mask;
__sigemptyset (&mask); __sigemptyset (&mask);
__sigaddset (&mask, SIGCANCEL); __sigaddset (&mask, SIGCANCEL);
(void) INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_UNBLOCK, &mask, INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_UNBLOCK, &mask,
NULL, _NSIG / 8); NULL, _NSIG / 8);
} }

View File

@ -297,13 +297,12 @@ __pthread_mutex_trylock (pthread_mutex_t *mutex)
int private = (robust int private = (robust
? PTHREAD_ROBUST_MUTEX_PSHARED (mutex) ? PTHREAD_ROBUST_MUTEX_PSHARED (mutex)
: PTHREAD_MUTEX_PSHARED (mutex)); : PTHREAD_MUTEX_PSHARED (mutex));
INTERNAL_SYSCALL_DECL (__err); int e = INTERNAL_SYSCALL_CALL (futex, &mutex->__data.__lock,
int e = INTERNAL_SYSCALL (futex, __err, 4, &mutex->__data.__lock,
__lll_private_flag (FUTEX_TRYLOCK_PI, __lll_private_flag (FUTEX_TRYLOCK_PI,
private), 0, 0); private), 0, 0);
if (INTERNAL_SYSCALL_ERROR_P (e, __err) if (INTERNAL_SYSCALL_ERROR_P (e)
&& INTERNAL_SYSCALL_ERRNO (e, __err) == EWOULDBLOCK) && INTERNAL_SYSCALL_ERRNO (e) == EWOULDBLOCK)
{ {
/* The kernel has not yet finished the mutex owner death. /* The kernel has not yet finished the mutex owner death.
We do not need to ensure ordering wrt another memory We do not need to ensure ordering wrt another memory

View File

@ -39,16 +39,11 @@ pthread_sigmask (int how, const sigset_t *newmask, sigset_t *oldmask)
newmask = &local_newmask; newmask = &local_newmask;
} }
#ifdef INTERNAL_SYSCALL
/* We know that realtime signals are available if NPTL is used. */ /* We know that realtime signals are available if NPTL is used. */
INTERNAL_SYSCALL_DECL (err); int result = INTERNAL_SYSCALL_CALL (rt_sigprocmask, how, newmask,
int result = INTERNAL_SYSCALL (rt_sigprocmask, err, 4, how, newmask,
oldmask, _NSIG / 8); oldmask, _NSIG / 8);
return (INTERNAL_SYSCALL_ERROR_P (result, err) return (INTERNAL_SYSCALL_ERROR_P (result)
? INTERNAL_SYSCALL_ERRNO (result, err) ? INTERNAL_SYSCALL_ERRNO (result)
: 0); : 0);
#else
return sigprocmask (how, newmask, oldmask) == -1 ? errno : 0;
#endif
} }

View File

@ -21,6 +21,5 @@
void void
thrd_yield (void) thrd_yield (void)
{ {
INTERNAL_SYSCALL_DECL (err); INTERNAL_SYSCALL_CALL (sched_yield);
INTERNAL_SYSCALL_CALL (sched_yield, err);
} }

View File

@ -96,11 +96,10 @@ typedef struct
special attention since 'errno' is not yet available and if the special attention since 'errno' is not yet available and if the
operation can cause a failure 'errno' must not be touched. */ operation can cause a failure 'errno' must not be touched. */
# define TLS_INIT_TP(tcbp) \ # define TLS_INIT_TP(tcbp) \
({ INTERNAL_SYSCALL_DECL (err); \ ({ long int result_var; \
long result_var; \ result_var = INTERNAL_SYSCALL_CALL (set_thread_area, \
result_var = INTERNAL_SYSCALL (set_thread_area, err, 1, \
(char *) (tcbp) + TLS_TCB_OFFSET); \ (char *) (tcbp) + TLS_TCB_OFFSET); \
INTERNAL_SYSCALL_ERROR_P (result_var, err) \ INTERNAL_SYSCALL_ERROR_P (result_var) \
? "unknown error" : NULL; }) ? "unknown error" : NULL; })
/* Return the address of the dtv for the current thread. */ /* Return the address of the dtv for the current thread. */

View File

@ -202,8 +202,7 @@ tls_fill_user_desc (union user_desc_init *desc,
tls_fill_user_desc (&_segdescr, -1, _thrdescr); \ tls_fill_user_desc (&_segdescr, -1, _thrdescr); \
\ \
/* Install the TLS. */ \ /* Install the TLS. */ \
INTERNAL_SYSCALL_DECL (err); \ _result = INTERNAL_SYSCALL_CALL (set_thread_area, &_segdescr.desc); \
_result = INTERNAL_SYSCALL (set_thread_area, err, 1, &_segdescr.desc); \
\ \
if (_result == 0) \ if (_result == 0) \
/* We know the index in the GDT, now load the segment register. \ /* We know the index in the GDT, now load the segment register. \

View File

@ -95,12 +95,11 @@ typedef struct
operation can cause a failure 'errno' must not be touched. */ operation can cause a failure 'errno' must not be touched. */
# define TLS_INIT_TP(tcbp) \ # define TLS_INIT_TP(tcbp) \
({ \ ({ \
INTERNAL_SYSCALL_DECL (err); \
int _sys_result; \ int _sys_result; \
\ \
_sys_result = INTERNAL_SYSCALL (set_thread_area, err, 1, \ _sys_result = INTERNAL_SYSCALL_CALL (set_thread_area, \
((void *) (tcbp)) + TLS_TCB_OFFSET); \ ((void *) (tcbp)) + TLS_TCB_OFFSET); \
INTERNAL_SYSCALL_ERROR_P (_sys_result, err) ? "unknown error" : NULL; }) INTERNAL_SYSCALL_ERROR_P (_sys_result) ? "unknown error" : NULL; })
# define TLS_DEFINE_INIT_TP(tp, pd) \ # define TLS_DEFINE_INIT_TP(tp, pd) \
void *tp = (void *) (pd) + TLS_TCB_OFFSET + TLS_PRE_TCB_SIZE void *tp = (void *) (pd) + TLS_TCB_OFFSET + TLS_PRE_TCB_SIZE

View File

@ -120,11 +120,10 @@ typedef struct
special attention since 'errno' is not yet available and if the special attention since 'errno' is not yet available and if the
operation can cause a failure 'errno' must not be touched. */ operation can cause a failure 'errno' must not be touched. */
# define TLS_INIT_TP(tcbp) \ # define TLS_INIT_TP(tcbp) \
({ INTERNAL_SYSCALL_DECL (err); \ ({ long int result_var; \
long result_var; \ result_var = INTERNAL_SYSCALL_CALL (set_thread_area, \
result_var = INTERNAL_SYSCALL (set_thread_area, err, 1, \
(char *) (tcbp) + TLS_TCB_OFFSET); \ (char *) (tcbp) + TLS_TCB_OFFSET); \
INTERNAL_SYSCALL_ERROR_P (result_var, err) \ INTERNAL_SYSCALL_ERROR_P (result_var) \
? "unknown error" : NULL; }) ? "unknown error" : NULL; })
/* Value passed to 'clone' for initialization of the thread register. */ /* Value passed to 'clone' for initialization of the thread register. */

View File

@ -67,11 +67,10 @@
# define lll_futex_syscall(nargs, futexp, op, ...) \ # define lll_futex_syscall(nargs, futexp, op, ...) \
({ \ ({ \
INTERNAL_SYSCALL_DECL (__err); \ long int __ret = INTERNAL_SYSCALL (futex, nargs, futexp, op, \
long int __ret = INTERNAL_SYSCALL (futex, __err, nargs, futexp, op, \
__VA_ARGS__); \ __VA_ARGS__); \
(__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (__ret, __err)) \ (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (__ret)) \
? -INTERNAL_SYSCALL_ERRNO (__ret, __err) : 0); \ ? -INTERNAL_SYSCALL_ERRNO (__ret) : 0); \
}) })
/* For most of these macros, the return value is never really used. /* For most of these macros, the return value is never really used.

View File

@ -67,11 +67,10 @@ libc_hidden_proto (__feraiseexcept_soft)
do \ do \
{ \ { \
int _r; \ int _r; \
INTERNAL_SYSCALL_DECL (_err); \
\ \
_spefscr = fegetenv_register (); \ _spefscr = fegetenv_register (); \
_r = INTERNAL_SYSCALL (prctl, _err, 2, PR_GET_FPEXC, &_ftrapex); \ _r = INTERNAL_SYSCALL_CALL (prctl, PR_GET_FPEXC, &_ftrapex); \
if (INTERNAL_SYSCALL_ERROR_P (_r, _err)) \ if (INTERNAL_SYSCALL_ERROR_P (_r)) \
_ftrapex = 0; \ _ftrapex = 0; \
} \ } \
while (0) while (0)

View File

@ -28,24 +28,24 @@
#define __SYSCALL_CONCAT(a,b) __SYSCALL_CONCAT_X (a, b) #define __SYSCALL_CONCAT(a,b) __SYSCALL_CONCAT_X (a, b)
#define __INTERNAL_SYSCALL0(name, err) \ #define __INTERNAL_SYSCALL0(name) \
INTERNAL_SYSCALL (name, err, 0) INTERNAL_SYSCALL (name, 0)
#define __INTERNAL_SYSCALL1(name, err, a1) \ #define __INTERNAL_SYSCALL1(name, a1) \
INTERNAL_SYSCALL (name, err, 1, a1) INTERNAL_SYSCALL (name, 1, a1)
#define __INTERNAL_SYSCALL2(name, err, a1, a2) \ #define __INTERNAL_SYSCALL2(name, a1, a2) \
INTERNAL_SYSCALL (name, err, 2, a1, a2) INTERNAL_SYSCALL (name, 2, a1, a2)
#define __INTERNAL_SYSCALL3(name, err, a1, a2, a3) \ #define __INTERNAL_SYSCALL3(name, a1, a2, a3) \
INTERNAL_SYSCALL (name, err, 3, a1, a2, a3) INTERNAL_SYSCALL (name, 3, a1, a2, a3)
#define __INTERNAL_SYSCALL4(name, err, a1, a2, a3, a4) \ #define __INTERNAL_SYSCALL4(name, a1, a2, a3, a4) \
INTERNAL_SYSCALL (name, err, 4, a1, a2, a3, a4) INTERNAL_SYSCALL (name, 4, a1, a2, a3, a4)
#define __INTERNAL_SYSCALL5(name, err, a1, a2, a3, a4, a5) \ #define __INTERNAL_SYSCALL5(name, a1, a2, a3, a4, a5) \
INTERNAL_SYSCALL (name, err, 5, a1, a2, a3, a4, a5) INTERNAL_SYSCALL (name, 5, a1, a2, a3, a4, a5)
#define __INTERNAL_SYSCALL6(name, err, a1, a2, a3, a4, a5, a6) \ #define __INTERNAL_SYSCALL6(name, a1, a2, a3, a4, a5, a6) \
INTERNAL_SYSCALL (name, err, 6, a1, a2, a3, a4, a5, a6) INTERNAL_SYSCALL (name, 6, a1, a2, a3, a4, a5, a6)
#define __INTERNAL_SYSCALL7(name, err, a1, a2, a3, a4, a5, a6, a7) \ #define __INTERNAL_SYSCALL7(name, a1, a2, a3, a4, a5, a6, a7) \
INTERNAL_SYSCALL (name, err, 7, a1, a2, a3, a4, a5, a6, a7) INTERNAL_SYSCALL (name, 7, a1, a2, a3, a4, a5, a6, a7)
#define __INTERNAL_SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,o,...) o #define __INTERNAL_SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,...) n
#define __INTERNAL_SYSCALL_NARGS(...) \ #define __INTERNAL_SYSCALL_NARGS(...) \
__INTERNAL_SYSCALL_NARGS_X (__VA_ARGS__,7,6,5,4,3,2,1,0,) __INTERNAL_SYSCALL_NARGS_X (__VA_ARGS__,7,6,5,4,3,2,1,0,)
#define __INTERNAL_SYSCALL_DISP(b,...) \ #define __INTERNAL_SYSCALL_DISP(b,...) \

View File

@ -171,7 +171,7 @@
# define SINGLE_THREAD_BY_GLOBAL 1 # define SINGLE_THREAD_BY_GLOBAL 1
# undef INTERNAL_SYSCALL_RAW # undef INTERNAL_SYSCALL_RAW
# define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \ # define INTERNAL_SYSCALL_RAW(name, nr, args...) \
({ long _sys_result; \ ({ long _sys_result; \
{ \ { \
LOAD_ARGS_##nr (args) \ LOAD_ARGS_##nr (args) \
@ -183,12 +183,12 @@
_sys_result; }) _sys_result; })
# undef INTERNAL_SYSCALL # undef INTERNAL_SYSCALL
# define INTERNAL_SYSCALL(name, err, nr, args...) \ # define INTERNAL_SYSCALL(name, nr, args...) \
INTERNAL_SYSCALL_RAW(SYS_ify(name), err, nr, args) INTERNAL_SYSCALL_RAW(SYS_ify(name), nr, args)
# undef INTERNAL_SYSCALL_AARCH64 # undef INTERNAL_SYSCALL_AARCH64
# define INTERNAL_SYSCALL_AARCH64(name, err, nr, args...) \ # define INTERNAL_SYSCALL_AARCH64(name, nr, args...) \
INTERNAL_SYSCALL_RAW(__ARM_NR_##name, err, nr, args) INTERNAL_SYSCALL_RAW(__ARM_NR_##name, nr, args)
# define LOAD_ARGS_0() \ # define LOAD_ARGS_0() \
register long _x0 asm ("x0"); register long _x0 asm ("x0");
@ -231,8 +231,8 @@
# define ASM_ARGS_7 ASM_ARGS_6, "r" (_x6) # define ASM_ARGS_7 ASM_ARGS_6, "r" (_x6)
# undef INTERNAL_SYSCALL_NCS # undef INTERNAL_SYSCALL_NCS
# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ # define INTERNAL_SYSCALL_NCS(number, nr, args...) \
INTERNAL_SYSCALL_RAW (number, err, nr, args) INTERNAL_SYSCALL_RAW (number, nr, args)
#endif /* __ASSEMBLER__ */ #endif /* __ASSEMBLER__ */

View File

@ -31,8 +31,7 @@ __aio_start_notify_thread (void)
{ {
sigset_t ss; sigset_t ss;
sigemptyset (&ss); sigemptyset (&ss);
INTERNAL_SYSCALL_DECL (err); INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, &ss, NULL, _NSIG / 8);
INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &ss, NULL, _NSIG / 8);
} }
extern inline int extern inline int
@ -53,14 +52,12 @@ __aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *),
sigset_t ss; sigset_t ss;
sigset_t oss; sigset_t oss;
sigfillset (&ss); sigfillset (&ss);
INTERNAL_SYSCALL_DECL (err); INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, &ss, &oss, _NSIG / 8);
INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &ss, &oss, _NSIG / 8);
int ret = pthread_create (threadp, &attr, tf, arg); int ret = pthread_create (threadp, &attr, tf, arg);
/* Restore the signal mask. */ /* Restore the signal mask. */
INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &oss, NULL, INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, &oss, NULL, _NSIG / 8);
_NSIG / 8);
(void) pthread_attr_destroy (&attr); (void) pthread_attr_destroy (&attr);
return ret; return ret;

View File

@ -33,23 +33,22 @@
int int
__fxstat (int vers, int fd, struct stat *buf) __fxstat (int vers, int fd, struct stat *buf)
{ {
INTERNAL_SYSCALL_DECL (err);
int result; int result;
struct kernel_stat kbuf; struct kernel_stat kbuf;
if (vers == _STAT_VER_KERNEL64) if (vers == _STAT_VER_KERNEL64)
{ {
result = INTERNAL_SYSCALL (fstat64, err, 2, fd, buf); result = INTERNAL_SYSCALL_CALL (fstat64, fd, buf);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result)))
return result; return result;
__set_errno (INTERNAL_SYSCALL_ERRNO (result, err)); __set_errno (INTERNAL_SYSCALL_ERRNO (result));
return -1; return -1;
} }
result = INTERNAL_SYSCALL (fstat, err, 2, fd, &kbuf); result = INTERNAL_SYSCALL_CALL (fstat, fd, &kbuf);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result)))
return __xstat_conv (vers, &kbuf, buf); return __xstat_conv (vers, &kbuf, buf);
__set_errno (INTERNAL_SYSCALL_ERRNO (result, err)); __set_errno (INTERNAL_SYSCALL_ERRNO (result));
return -1; return -1;
} }
hidden_def (__fxstat) hidden_def (__fxstat)

View File

@ -33,7 +33,6 @@
int int
__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
{ {
INTERNAL_SYSCALL_DECL (err);
int result, errno_out; int result, errno_out;
/* ??? The __fxstatat entry point is new enough that it must be using /* ??? The __fxstatat entry point is new enough that it must be using
@ -41,10 +40,10 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
cannot actually check this, lest the compiler not optimize the rest cannot actually check this, lest the compiler not optimize the rest
of the function away. */ of the function away. */
result = INTERNAL_SYSCALL (fstatat64, err, 4, fd, file, st, flag); result = INTERNAL_SYSCALL_CALL (fstatat64, fd, file, st, flag);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result)))
return result; return result;
errno_out = INTERNAL_SYSCALL_ERRNO (result, err); errno_out = INTERNAL_SYSCALL_ERRNO (result);
__set_errno (errno_out); __set_errno (errno_out);
return -1; return -1;
} }

View File

@ -33,23 +33,22 @@
int int
__lxstat (int vers, const char *name, struct stat *buf) __lxstat (int vers, const char *name, struct stat *buf)
{ {
INTERNAL_SYSCALL_DECL (err);
int result; int result;
struct kernel_stat kbuf; struct kernel_stat kbuf;
if (vers == _STAT_VER_KERNEL64) if (vers == _STAT_VER_KERNEL64)
{ {
result = INTERNAL_SYSCALL (lstat64, err, 2, name, buf); result = INTERNAL_SYSCALL_CALL (lstat64, name, buf);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result)))
return result; return result;
__set_errno (INTERNAL_SYSCALL_ERRNO (result, err)); __set_errno (INTERNAL_SYSCALL_ERRNO (result));
return -1; return -1;
} }
result = INTERNAL_SYSCALL (lstat, err, 2, name, &kbuf); result = INTERNAL_SYSCALL_CALL (lstat, name, &kbuf);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result)))
return __xstat_conv (vers, &kbuf, buf); return __xstat_conv (vers, &kbuf, buf);
__set_errno (INTERNAL_SYSCALL_ERRNO (result, err)); __set_errno (INTERNAL_SYSCALL_ERRNO (result));
return -1; return -1;
} }
hidden_def (__lxstat) hidden_def (__lxstat)

View File

@ -170,10 +170,10 @@ __LABEL(name) \
#else /* !ASSEMBLER */ #else /* !ASSEMBLER */
#define INTERNAL_SYSCALL(name, err_out, nr, args...) \ #define INTERNAL_SYSCALL(name, 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, nr, args...) \
internal_syscall##nr(name, args) internal_syscall##nr(name, args)
/* The normal Alpha calling convention sign-extends 32-bit quantties /* The normal Alpha calling convention sign-extends 32-bit quantties

View File

@ -33,23 +33,22 @@
int int
__xstat (int vers, const char *name, struct stat *buf) __xstat (int vers, const char *name, struct stat *buf)
{ {
INTERNAL_SYSCALL_DECL (err);
int result; int result;
struct kernel_stat kbuf; struct kernel_stat kbuf;
if (vers == _STAT_VER_KERNEL64) if (vers == _STAT_VER_KERNEL64)
{ {
result = INTERNAL_SYSCALL (stat64, err, 2, name, buf); result = INTERNAL_SYSCALL_CALL (stat64, name, buf);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result)))
return result; return result;
__set_errno (INTERNAL_SYSCALL_ERRNO (result, err)); __set_errno (INTERNAL_SYSCALL_ERRNO (result));
return -1; return -1;
} }
result = INTERNAL_SYSCALL (stat, err, 2, name, &kbuf); result = INTERNAL_SYSCALL_CALL (stat, name, &kbuf);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result)))
return __xstat_conv (vers, &kbuf, buf); return __xstat_conv (vers, &kbuf, buf);
__set_errno (INTERNAL_SYSCALL_ERRNO (result, err)); __set_errno (INTERNAL_SYSCALL_ERRNO (result));
return -1; return -1;
} }
hidden_def (__xstat) hidden_def (__xstat)

View File

@ -20,7 +20,7 @@
/* This definition is Linux-specific. */ /* This definition is Linux-specific. */
#define CLEAR_CACHE(BEG,END) \ #define CLEAR_CACHE(BEG,END) \
INTERNAL_SYSCALL (cacheflush, , 3, (BEG), (END), 0) INTERNAL_SYSCALL_CALL (cacheflush, (BEG), (END), 0)
#endif #endif

View File

@ -328,7 +328,7 @@ __local_syscall_error: \
then unwinding will fail higher up the stack. So we move the then unwinding will fail higher up the stack. So we move the
syscall out of line and provide its own unwind information. */ syscall out of line and provide its own unwind information. */
# undef INTERNAL_SYSCALL_RAW # undef INTERNAL_SYSCALL_RAW
# define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \ # define INTERNAL_SYSCALL_RAW(name, nr, args...) \
({ \ ({ \
register int _a1 asm ("a1"); \ register int _a1 asm ("a1"); \
int _nametmp = name; \ int _nametmp = name; \
@ -341,7 +341,7 @@ __local_syscall_error: \
_a1; }) _a1; })
#else /* ARM */ #else /* ARM */
# undef INTERNAL_SYSCALL_RAW # undef INTERNAL_SYSCALL_RAW
# define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \ # define INTERNAL_SYSCALL_RAW(name, nr, args...) \
({ \ ({ \
register int _a1 asm ("r0"), _nr asm ("r7"); \ register int _a1 asm ("r0"), _nr asm ("r7"); \
LOAD_ARGS_##nr (args) \ LOAD_ARGS_##nr (args) \
@ -354,8 +354,8 @@ __local_syscall_error: \
#endif #endif
#undef INTERNAL_SYSCALL #undef INTERNAL_SYSCALL
#define INTERNAL_SYSCALL(name, err, nr, args...) \ #define INTERNAL_SYSCALL(name, nr, args...) \
INTERNAL_SYSCALL_RAW(SYS_ify(name), err, nr, args) INTERNAL_SYSCALL_RAW(SYS_ify(name), nr, args)
#define VDSO_NAME "LINUX_2.6" #define VDSO_NAME "LINUX_2.6"
#define VDSO_HASH 61765110 #define VDSO_HASH 61765110
@ -407,8 +407,8 @@ __local_syscall_error: \
/* For EABI, non-constant syscalls are actually pretty easy... */ /* For EABI, non-constant syscalls are actually pretty easy... */
#undef INTERNAL_SYSCALL_NCS #undef INTERNAL_SYSCALL_NCS
#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ #define INTERNAL_SYSCALL_NCS(number, nr, args...) \
INTERNAL_SYSCALL_RAW (number, err, nr, args) INTERNAL_SYSCALL_RAW (number, nr, args)
#define SINGLE_THREAD_BY_GLOBAL 1 #define SINGLE_THREAD_BY_GLOBAL 1

View File

@ -31,10 +31,9 @@
special attention since 'errno' is not yet available and if the special attention since 'errno' is not yet available and if the
operation can cause a failure 'errno' must not be touched. */ operation can cause a failure 'errno' must not be touched. */
# define TLS_INIT_TP(tcbp) \ # define TLS_INIT_TP(tcbp) \
({ INTERNAL_SYSCALL_DECL (err); \ ({ long int result_var; \
long int result_var; \ result_var = INTERNAL_SYSCALL_CALL (set_tls, 1, (tcbp)); \
result_var = INTERNAL_SYSCALL (set_tls, err, 1, (tcbp)); \ INTERNAL_SYSCALL_ERROR_P (result_var) \
INTERNAL_SYSCALL_ERROR_P (result_var, err) \
? "unknown error" : NULL; }) ? "unknown error" : NULL; })
#endif /* __ASSEMBLER__ */ #endif /* __ASSEMBLER__ */

View File

@ -30,21 +30,20 @@ __clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
const clockid_t pidclock = MAKE_PROCESS_CPUCLOCK (pid, CPUCLOCK_SCHED); const clockid_t pidclock = MAKE_PROCESS_CPUCLOCK (pid, CPUCLOCK_SCHED);
INTERNAL_SYSCALL_DECL (err); int r = INTERNAL_SYSCALL_CALL (clock_getres, pidclock, NULL);
int r = INTERNAL_SYSCALL (clock_getres, err, 2, pidclock, NULL); if (!INTERNAL_SYSCALL_ERROR_P (r))
if (!INTERNAL_SYSCALL_ERROR_P (r, err))
{ {
*clock_id = pidclock; *clock_id = pidclock;
return 0; return 0;
} }
if (INTERNAL_SYSCALL_ERRNO (r, err) == EINVAL) if (INTERNAL_SYSCALL_ERRNO (r) == EINVAL)
{ {
/* The clock_getres system call checked the PID for us. */ /* The clock_getres system call checked the PID for us. */
return ESRCH; return ESRCH;
} }
else else
return INTERNAL_SYSCALL_ERRNO (r, err); return INTERNAL_SYSCALL_ERRNO (r);
} }
versioned_symbol (libc, __clock_getcpuclockid, clock_getcpuclockid, GLIBC_2_17); versioned_symbol (libc, __clock_getcpuclockid, clock_getcpuclockid, GLIBC_2_17);

View File

@ -39,23 +39,21 @@ __clock_nanosleep_time64 (clockid_t clock_id, int flags, const struct __timespec
/* If the call is interrupted by a signal handler or encounters an error, /* If the call is interrupted by a signal handler or encounters an error,
it returns a positive value similar to errno. */ it returns a positive value similar to errno. */
INTERNAL_SYSCALL_DECL (err);
#ifdef __ASSUME_TIME64_SYSCALLS #ifdef __ASSUME_TIME64_SYSCALLS
# ifndef __NR_clock_nanosleep_time64 # ifndef __NR_clock_nanosleep_time64
# define __NR_clock_nanosleep_time64 __NR_clock_nanosleep # define __NR_clock_nanosleep_time64 __NR_clock_nanosleep
# endif # endif
r = INTERNAL_SYSCALL_CANCEL (clock_nanosleep_time64, err, clock_id, r = INTERNAL_SYSCALL_CANCEL (clock_nanosleep_time64, clock_id,
flags, req, rem); flags, req, rem);
#else #else
# ifdef __NR_clock_nanosleep_time64 # ifdef __NR_clock_nanosleep_time64
r = INTERNAL_SYSCALL_CANCEL (clock_nanosleep_time64, err, clock_id, r = INTERNAL_SYSCALL_CANCEL (clock_nanosleep_time64, clock_id,
flags, req, rem); flags, req, rem);
if (! INTERNAL_SYSCALL_ERROR_P (r, err)) if (! INTERNAL_SYSCALL_ERROR_P (r))
return 0; return 0;
if (INTERNAL_SYSCALL_ERRNO (r, err) != ENOSYS) if (INTERNAL_SYSCALL_ERRNO (r) != ENOSYS)
return INTERNAL_SYSCALL_ERRNO (r, err); return INTERNAL_SYSCALL_ERRNO (r);
# endif /* __NR_clock_nanosleep_time64 */ # endif /* __NR_clock_nanosleep_time64 */
if (! in_time_t_range (req->tv_sec)) if (! in_time_t_range (req->tv_sec))
@ -66,18 +64,18 @@ __clock_nanosleep_time64 (clockid_t clock_id, int flags, const struct __timespec
struct timespec tr32; struct timespec tr32;
struct timespec ts32 = valid_timespec64_to_timespec (*req); struct timespec ts32 = valid_timespec64_to_timespec (*req);
r = INTERNAL_SYSCALL_CANCEL (clock_nanosleep, err, clock_id, flags, r = INTERNAL_SYSCALL_CANCEL (clock_nanosleep, clock_id, flags,
&ts32, &tr32); &ts32, &tr32);
if (INTERNAL_SYSCALL_ERROR_P (r, err)) if (INTERNAL_SYSCALL_ERROR_P (r))
{ {
if (INTERNAL_SYSCALL_ERRNO (r, err) == EINTR && rem != NULL if (INTERNAL_SYSCALL_ERRNO (r) == EINTR && rem != NULL
&& (flags & TIMER_ABSTIME) == 0) && (flags & TIMER_ABSTIME) == 0)
*rem = valid_timespec_to_timespec64 (tr32); *rem = valid_timespec_to_timespec64 (tr32);
} }
#endif /* __ASSUME_TIME64_SYSCALLS */ #endif /* __ASSUME_TIME64_SYSCALLS */
return (INTERNAL_SYSCALL_ERROR_P (r, err) return (INTERNAL_SYSCALL_ERROR_P (r)
? INTERNAL_SYSCALL_ERRNO (r, err) : 0); ? INTERNAL_SYSCALL_ERRNO (r) : 0);
} }
#if __TIMESIZE != 64 #if __TIMESIZE != 64

View File

@ -110,7 +110,6 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr,
/* Now we have the possibility to set scheduling parameters etc. */ /* Now we have the possibility to set scheduling parameters etc. */
if (attr != NULL) if (attr != NULL)
{ {
INTERNAL_SYSCALL_DECL (err);
int res; int res;
/* Set the affinity mask if necessary. */ /* Set the affinity mask if necessary. */
@ -118,21 +117,19 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr,
{ {
assert (*stopped_start); assert (*stopped_start);
res = INTERNAL_SYSCALL (sched_setaffinity, err, 3, pd->tid, res = INTERNAL_SYSCALL_CALL (sched_setaffinity, pd->tid,
attr->cpusetsize, attr->cpuset); attr->cpusetsize, attr->cpuset);
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err))) if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res)))
err_out: err_out:
{ {
/* The operation failed. We have to kill the thread. /* The operation failed. We have to kill the thread.
We let the normal cancellation mechanism do the work. */ We let the normal cancellation mechanism do the work. */
pid_t pid = __getpid (); pid_t pid = __getpid ();
INTERNAL_SYSCALL_DECL (err2); INTERNAL_SYSCALL_CALL (tgkill, pid, pd->tid, SIGCANCEL);
(void) INTERNAL_SYSCALL_CALL (tgkill, err2, pid, pd->tid,
SIGCANCEL);
return INTERNAL_SYSCALL_ERRNO (res, err); return INTERNAL_SYSCALL_ERRNO (res);
} }
} }
@ -141,10 +138,10 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr,
{ {
assert (*stopped_start); assert (*stopped_start);
res = INTERNAL_SYSCALL (sched_setscheduler, err, 3, pd->tid, res = INTERNAL_SYSCALL_CALL (sched_setscheduler, pd->tid,
pd->schedpolicy, &pd->schedparam); pd->schedpolicy, &pd->schedparam);
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err))) if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res)))
goto err_out; goto err_out;
} }
} }

View File

@ -294,7 +294,7 @@ __local_syscall_error: \
#else /* not __ASSEMBLER__ */ #else /* not __ASSEMBLER__ */
# undef INTERNAL_SYSCALL_RAW # undef INTERNAL_SYSCALL_RAW
# define INTERNAL_SYSCALL_RAW0(name, err, dummy...) \ # define INTERNAL_SYSCALL_RAW0(name, dummy...) \
({unsigned int __sys_result; \ ({unsigned int __sys_result; \
{ \ { \
register int _a1 __asm__ ("a0"), _nr __asm__ ("r7"); \ register int _a1 __asm__ ("a0"), _nr __asm__ ("r7"); \
@ -307,7 +307,7 @@ __local_syscall_error: \
} \ } \
(int) __sys_result; }) (int) __sys_result; })
# define INTERNAL_SYSCALL_RAW1(name, err, arg1) \ # define INTERNAL_SYSCALL_RAW1(name, arg1) \
({unsigned int __sys_result; \ ({unsigned int __sys_result; \
register int _tmp_arg1 = (int)(arg1); \ register int _tmp_arg1 = (int)(arg1); \
{ \ { \
@ -322,7 +322,7 @@ __local_syscall_error: \
} \ } \
(int) __sys_result; }) (int) __sys_result; })
# define INTERNAL_SYSCALL_RAW2(name, err, arg1, arg2) \ # define INTERNAL_SYSCALL_RAW2(name, arg1, arg2) \
({unsigned int __sys_result; \ ({unsigned int __sys_result; \
register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \ register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \
{ \ { \
@ -338,7 +338,7 @@ __local_syscall_error: \
} \ } \
(int) __sys_result; }) (int) __sys_result; })
# define INTERNAL_SYSCALL_RAW3(name, err, arg1, arg2, arg3) \ # define INTERNAL_SYSCALL_RAW3(name, arg1, arg2, arg3) \
({unsigned int __sys_result; \ ({unsigned int __sys_result; \
register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \ register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \
register int _tmp_arg3 = (int)(arg3); \ register int _tmp_arg3 = (int)(arg3); \
@ -359,7 +359,7 @@ __local_syscall_error: \
} \ } \
(int) __sys_result; }) (int) __sys_result; })
# define INTERNAL_SYSCALL_RAW4(name, err, arg1, arg2, arg3, arg4) \ # define INTERNAL_SYSCALL_RAW4(name, arg1, arg2, arg3, arg4) \
({unsigned int __sys_result; \ ({unsigned int __sys_result; \
register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \ register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \
register int _tmp_arg3 = (int)(arg3), _tmp_arg4 = (int)(arg4); \ register int _tmp_arg3 = (int)(arg3), _tmp_arg4 = (int)(arg4); \
@ -379,7 +379,7 @@ __local_syscall_error: \
} \ } \
(int) __sys_result; }) (int) __sys_result; })
# define INTERNAL_SYSCALL_RAW5(name, err, arg1, arg2, arg3, arg4, \ # define INTERNAL_SYSCALL_RAW5(name, arg1, arg2, arg3, arg4, \
arg5) \ arg5) \
({unsigned int __sys_result; \ ({unsigned int __sys_result; \
register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \ register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \
@ -402,7 +402,7 @@ __local_syscall_error: \
} \ } \
(int) __sys_result; }) (int) __sys_result; })
# define INTERNAL_SYSCALL_RAW6(name, err, arg1, arg2, arg3, arg4, \ # define INTERNAL_SYSCALL_RAW6(name, arg1, arg2, arg3, arg4, \
arg5, arg6) \ arg5, arg6) \
({unsigned int __sys_result; \ ({unsigned int __sys_result; \
register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \ register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \
@ -426,7 +426,7 @@ __local_syscall_error: \
} \ } \
(int) __sys_result; }) (int) __sys_result; })
# define INTERNAL_SYSCALL_RAW7(name, err, arg1, arg2, arg3, arg4, \ # define INTERNAL_SYSCALL_RAW7(name, arg1, arg2, arg3, arg4, \
arg5, arg6, arg7) \ arg5, arg6, arg7) \
({unsigned int __sys_result; \ ({unsigned int __sys_result; \
register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \ register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \
@ -454,12 +454,12 @@ __local_syscall_error: \
(int) __sys_result; }) (int) __sys_result; })
# undef INTERNAL_SYSCALL # undef INTERNAL_SYSCALL
# define INTERNAL_SYSCALL(name, err, nr, args...) \ # define INTERNAL_SYSCALL(name, nr, args...) \
INTERNAL_SYSCALL_RAW##nr(SYS_ify(name), err, args) INTERNAL_SYSCALL_RAW##nr(SYS_ify(name), args)
# undef INTERNAL_SYSCALL_NCS # undef INTERNAL_SYSCALL_NCS
# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ # define INTERNAL_SYSCALL_NCS(number, nr, args...) \
INTERNAL_SYSCALL_RAW##nr (number, err, args) INTERNAL_SYSCALL_RAW##nr (number, args)
#endif /* __ASSEMBLER__ */ #endif /* __ASSEMBLER__ */

View File

@ -26,17 +26,15 @@
static void static void
collect_default_sched (struct pthread *pd) collect_default_sched (struct pthread *pd)
{ {
INTERNAL_SYSCALL_DECL (scerr);
if ((pd->flags & ATTR_FLAG_POLICY_SET) == 0) if ((pd->flags & ATTR_FLAG_POLICY_SET) == 0)
{ {
pd->schedpolicy = INTERNAL_SYSCALL (sched_getscheduler, scerr, 1, 0); pd->schedpolicy = INTERNAL_SYSCALL_CALL (sched_getscheduler, 0);
pd->flags |= ATTR_FLAG_POLICY_SET; pd->flags |= ATTR_FLAG_POLICY_SET;
} }
if ((pd->flags & ATTR_FLAG_SCHED_SET) == 0) if ((pd->flags & ATTR_FLAG_SCHED_SET) == 0)
{ {
INTERNAL_SYSCALL (sched_getparam, scerr, 2, 0, &pd->schedparam); INTERNAL_SYSCALL_CALL (sched_getparam, 0, &pd->schedparam);
pd->flags |= ATTR_FLAG_SCHED_SET; pd->flags |= ATTR_FLAG_SCHED_SET;
} }
} }

View File

@ -37,11 +37,10 @@ _dl_get_origin (void)
char linkval[PATH_MAX]; char linkval[PATH_MAX];
char *result; char *result;
int len; int len;
INTERNAL_SYSCALL_DECL (err);
len = INTERNAL_SYSCALL (readlink, err, 3, "/proc/self/exe", linkval, len = INTERNAL_SYSCALL_CALL (readlink, "/proc/self/exe", linkval,
sizeof (linkval)); sizeof (linkval));
if (! INTERNAL_SYSCALL_ERROR_P (len, err) && len > 0 && linkval[0] != '[') if (! INTERNAL_SYSCALL_ERROR_P (len) && len > 0 && linkval[0] != '[')
{ {
/* We can use this value. */ /* We can use this value. */
assert (linkval[0] == '/'); assert (linkval[0] == '/');

View File

@ -33,6 +33,5 @@
static inline void static inline void
_dl_writev (int fd, const struct iovec *iov, size_t niov) _dl_writev (int fd, const struct iovec *iov, size_t niov)
{ {
INTERNAL_SYSCALL_DECL (err); INTERNAL_SYSCALL_CALL (writev, fd, iov, niov);
INTERNAL_SYSCALL (writev, err, 3, fd, iov, niov);
} }

View File

@ -32,7 +32,6 @@ __exit_thread (void)
of the caller and doing unexpectedly strange things. */ of the caller and doing unexpectedly strange things. */
while (1) while (1)
{ {
INTERNAL_SYSCALL_DECL (err); INTERNAL_SYSCALL_CALL (exit, 0);
INTERNAL_SYSCALL (exit, err, 1, 0);
} }
} }

View File

@ -51,14 +51,13 @@ __fcntl64_nocancel_adjusted (int fd, int cmd, void *arg)
{ {
if (cmd == F_GETOWN) if (cmd == F_GETOWN)
{ {
INTERNAL_SYSCALL_DECL (err);
struct f_owner_ex fex; struct f_owner_ex fex;
int res = INTERNAL_SYSCALL_CALL (fcntl64, err, fd, F_GETOWN_EX, &fex); int res = INTERNAL_SYSCALL_CALL (fcntl64, fd, F_GETOWN_EX, &fex);
if (!INTERNAL_SYSCALL_ERROR_P (res, err)) if (!INTERNAL_SYSCALL_ERROR_P (res))
return fex.type == F_OWNER_GID ? -fex.pid : fex.pid; return fex.type == F_OWNER_GID ? -fex.pid : fex.pid;
return INLINE_SYSCALL_ERROR_RETURN_VALUE return INLINE_SYSCALL_ERROR_RETURN_VALUE
(INTERNAL_SYSCALL_ERRNO (res, err)); (INTERNAL_SYSCALL_ERRNO (res));
} }
return INLINE_SYSCALL_CALL (fcntl64, fd, cmd, (void *) arg); return INLINE_SYSCALL_CALL (fcntl64, fd, cmd, (void *) arg);

View File

@ -37,15 +37,14 @@ int
__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
{ {
int result; int result;
INTERNAL_SYSCALL_DECL (err);
#ifdef STAT_IS_KERNEL_STAT #ifdef STAT_IS_KERNEL_STAT
# define kst (*st) # define kst (*st)
#else #else
struct kernel_stat kst; struct kernel_stat kst;
#endif #endif
result = INTERNAL_SYSCALL (newfstatat, err, 4, fd, file, &kst, flag); result = INTERNAL_SYSCALL_CALL (newfstatat, fd, file, &kst, flag);
if (!__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1)) if (!__glibc_likely (INTERNAL_SYSCALL_ERROR_P (result)))
{ {
#ifdef STAT_IS_KERNEL_STAT #ifdef STAT_IS_KERNEL_STAT
return 0; return 0;
@ -53,9 +52,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
return __xstat_conv (vers, &kst, st); return __xstat_conv (vers, &kst, st);
#endif #endif
} }
else return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result));
return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result,
err));
} }
libc_hidden_def (__fxstatat) libc_hidden_def (__fxstatat)
#if XSTAT_IS_XSTAT64 #if XSTAT_IS_XSTAT64

View File

@ -37,22 +37,19 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL);
int result; int result;
INTERNAL_SYSCALL_DECL (err);
#ifdef __NR_fstatat64 #ifdef __NR_fstatat64
result = INTERNAL_SYSCALL (fstatat64, err, 4, fd, file, st, flag); result = INTERNAL_SYSCALL_CALL (fstatat64, fd, file, st, flag);
#else #else
struct statx tmp; struct statx tmp;
result = INTERNAL_SYSCALL (statx, err, 5, fd, file, AT_NO_AUTOMOUNT | flag, result = INTERNAL_SYSCALL_CALL (statx, fd, file, AT_NO_AUTOMOUNT | flag,
STATX_BASIC_STATS, &tmp); STATX_BASIC_STATS, &tmp);
if (result == 0) if (result == 0)
__cp_stat64_statx (st, &tmp); __cp_stat64_statx (st, &tmp);
#endif #endif
if (!__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1)) if (!__glibc_likely (INTERNAL_SYSCALL_ERROR_P (result)))
return 0; return 0;
else return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result));
return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result,
err));
} }
libc_hidden_def (__fxstatat64) libc_hidden_def (__fxstatat64)

View File

@ -36,7 +36,6 @@ void ____longjmp_chk (__jmp_buf env, int val)
{ {
void *this_frame = __builtin_frame_address (0); void *this_frame = __builtin_frame_address (0);
void *saved_frame = JB_FRAME_ADDRESS (env); void *saved_frame = JB_FRAME_ADDRESS (env);
INTERNAL_SYSCALL_DECL (err);
stack_t ss; stack_t ss;
/* If "env" is from a frame that called us, we're all set. */ /* If "env" is from a frame that called us, we're all set. */
@ -44,7 +43,7 @@ void ____longjmp_chk (__jmp_buf env, int val)
__longjmp (env, val); __longjmp (env, val);
/* If we can't get the current stack state, give up and do the longjmp. */ /* If we can't get the current stack state, give up and do the longjmp. */
if (INTERNAL_SYSCALL (sigaltstack, err, 2, NULL, &ss) != 0) if (INTERNAL_SYSCALL_CALL (sigaltstack, NULL, &ss) != 0)
__longjmp (env, val); __longjmp (env, val);
/* If we we are executing on the alternate stack and within the /* If we we are executing on the alternate stack and within the

View File

@ -31,9 +31,7 @@ weak_alias (__curbrk, ___brk_addr)
int int
__brk (void *addr) __brk (void *addr)
{ {
INTERNAL_SYSCALL_DECL (err); __curbrk = (void *) INTERNAL_SYSCALL_CALL (brk, addr);
__curbrk = (void *) INTERNAL_SYSCALL (brk, err, 1, addr);
if (__curbrk < addr) if (__curbrk < addr)
{ {
__set_errno (ENOMEM); __set_errno (ENOMEM);

View File

@ -38,11 +38,10 @@ _dl_get_origin (void)
char linkval[PATH_MAX]; char linkval[PATH_MAX];
char *result; char *result;
int len; int len;
INTERNAL_SYSCALL_DECL (err);
len = INTERNAL_SYSCALL (readlinkat, err, 4, AT_FDCWD, "/proc/self/exe", len = INTERNAL_SYSCALL_CALL (readlinkat, AT_FDCWD, "/proc/self/exe",
linkval, sizeof (linkval)); linkval, sizeof (linkval));
if (! INTERNAL_SYSCALL_ERROR_P (len, err) && len > 0 && linkval[0] != '[') if (! INTERNAL_SYSCALL_ERROR_P (len) && len > 0 && linkval[0] != '[')
{ {
/* We can use this value. */ /* We can use this value. */
assert (linkval[0] == '/'); assert (linkval[0] == '/');

View File

@ -28,15 +28,14 @@
if ((unsigned long) (sp) > this_sp) \ if ((unsigned long) (sp) > this_sp) \
{ \ { \
stack_t oss; \ stack_t oss; \
INTERNAL_SYSCALL_DECL (err); \ int result = INTERNAL_SYSCALL_CALL (sigaltstack, NULL, &oss);\
int result = INTERNAL_SYSCALL (sigaltstack, err, 2, NULL, &oss);\
/* If we aren't using an alternate stack then we have already \ /* If we aren't using an alternate stack then we have already \
shown that we are jumping to a frame that doesn't exist so \ shown that we are jumping to a frame that doesn't exist so \
error out. If we are using an alternate stack we must prove \ error out. If we are using an alternate stack we must prove \
that we are jumping *out* of the alternate stack. Note that \ that we are jumping *out* of the alternate stack. Note that \
the check for that is the same as that for _STACK_GROWS_UP \ the check for that is the same as that for _STACK_GROWS_UP \
as for _STACK_GROWS_DOWN. */ \ as for _STACK_GROWS_DOWN. */ \
if (!INTERNAL_SYSCALL_ERROR_P (result, err) \ if (!INTERNAL_SYSCALL_ERROR_P (result) \
&& ((oss.ss_flags & SS_ONSTACK) == 0 \ && ((oss.ss_flags & SS_ONSTACK) == 0 \
|| ((unsigned long) oss.ss_sp + oss.ss_size \ || ((unsigned long) oss.ss_sp + oss.ss_size \
- (unsigned long) (sp)) < oss.ss_size)) \ - (unsigned long) (sp)) < oss.ss_size)) \

View File

@ -362,7 +362,7 @@ L(pre_end): ASM_LINE_SEP \
/* 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, nr, args...) \
({ \ ({ \
long __sys_res; \ long __sys_res; \
{ \ { \
@ -388,7 +388,7 @@ L(pre_end): ASM_LINE_SEP \
/* The _NCS variant allows non-constant syscall numbers. */ /* The _NCS variant allows non-constant syscall numbers. */
#undef INTERNAL_SYSCALL_NCS #undef INTERNAL_SYSCALL_NCS
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ #define INTERNAL_SYSCALL_NCS(name, nr, args...) \
({ \ ({ \
long __sys_res; \ long __sys_res; \
{ \ { \

View File

@ -36,8 +36,7 @@ weak_alias (__curbrk, ___brk_addr)
int int
__brk (void *addr) __brk (void *addr)
{ {
INTERNAL_SYSCALL_DECL (err); void *newbrk = (void *) INTERNAL_SYSCALL_CALL (brk, addr);
void *newbrk = (void *) INTERNAL_SYSCALL (brk, err, 1, addr);
__curbrk = newbrk; __curbrk = newbrk;
if (newbrk < addr) if (newbrk < addr)
return INLINE_SYSCALL_ERROR_RETURN_VALUE (ENOMEM); return INLINE_SYSCALL_ERROR_RETURN_VALUE (ENOMEM);

View File

@ -42,11 +42,9 @@ __fxstat (int vers, int fd, struct stat *buf)
{ {
struct stat64 buf64; struct stat64 buf64;
INTERNAL_SYSCALL_DECL (err); result = INTERNAL_SYSCALL_CALL (fstat64, fd, &buf64);
result = INTERNAL_SYSCALL (fstat64, err, 2, fd, &buf64); if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result)))
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err))) return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result));
return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result,
err));
else else
return __xstat32_conv (vers, &buf64, buf); return __xstat32_conv (vers, &buf64, buf);
} }

View File

@ -38,13 +38,11 @@ int
__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
{ {
int result; int result;
INTERNAL_SYSCALL_DECL (err);
struct stat64 st64; struct stat64 st64;
result = INTERNAL_SYSCALL (fstatat64, err, 4, fd, file, &st64, flag); result = INTERNAL_SYSCALL_CALL (fstatat64, fd, file, &st64, flag);
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err))) if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result)))
return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result, return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result));
err));
else else
return __xstat32_conv (vers, &st64, st); return __xstat32_conv (vers, &st64, st);
} }

View File

@ -43,11 +43,9 @@ __lxstat (int vers, const char *name, struct stat *buf)
{ {
struct stat64 buf64; struct stat64 buf64;
INTERNAL_SYSCALL_DECL (err); result = INTERNAL_SYSCALL_CALL (lstat64, name, &buf64);
result = INTERNAL_SYSCALL (lstat64, err, 2, name, &buf64); if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result)))
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err))) return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result));
return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result,
err));
else else
return __xstat32_conv (vers, &buf64, buf); return __xstat32_conv (vers, &buf64, buf);
} }

View File

@ -299,25 +299,25 @@ struct libc_do_syscall_args
The _NCS variant allows non-constant syscall numbers but it is not The _NCS variant allows non-constant syscall numbers but it is not
possible to use more than four parameters. */ possible to use more than four parameters. */
#undef INTERNAL_SYSCALL #undef INTERNAL_SYSCALL
#define INTERNAL_SYSCALL_MAIN_0(name, err, args...) \ #define INTERNAL_SYSCALL_MAIN_0(name, args...) \
INTERNAL_SYSCALL_MAIN_INLINE(name, err, 0, args) INTERNAL_SYSCALL_MAIN_INLINE(name, 0, args)
#define INTERNAL_SYSCALL_MAIN_1(name, err, args...) \ #define INTERNAL_SYSCALL_MAIN_1(name, args...) \
INTERNAL_SYSCALL_MAIN_INLINE(name, err, 1, args) INTERNAL_SYSCALL_MAIN_INLINE(name, 1, args)
#define INTERNAL_SYSCALL_MAIN_2(name, err, args...) \ #define INTERNAL_SYSCALL_MAIN_2(name, args...) \
INTERNAL_SYSCALL_MAIN_INLINE(name, err, 2, args) INTERNAL_SYSCALL_MAIN_INLINE(name, 2, args)
#define INTERNAL_SYSCALL_MAIN_3(name, err, args...) \ #define INTERNAL_SYSCALL_MAIN_3(name, args...) \
INTERNAL_SYSCALL_MAIN_INLINE(name, err, 3, args) INTERNAL_SYSCALL_MAIN_INLINE(name, 3, args)
#define INTERNAL_SYSCALL_MAIN_4(name, err, args...) \ #define INTERNAL_SYSCALL_MAIN_4(name, args...) \
INTERNAL_SYSCALL_MAIN_INLINE(name, err, 4, args) INTERNAL_SYSCALL_MAIN_INLINE(name, 4, args)
#define INTERNAL_SYSCALL_MAIN_5(name, err, args...) \ #define INTERNAL_SYSCALL_MAIN_5(name, args...) \
INTERNAL_SYSCALL_MAIN_INLINE(name, err, 5, args) INTERNAL_SYSCALL_MAIN_INLINE(name, 5, args)
/* Each object using 6-argument inline syscalls must include a /* Each object using 6-argument inline syscalls must include a
definition of __libc_do_syscall. */ definition of __libc_do_syscall. */
#ifdef OPTIMIZE_FOR_GCC_5 #ifdef OPTIMIZE_FOR_GCC_5
# define INTERNAL_SYSCALL_MAIN_6(name, err, args...) \ # define INTERNAL_SYSCALL_MAIN_6(name, args...) \
INTERNAL_SYSCALL_MAIN_INLINE(name, err, 6, args) INTERNAL_SYSCALL_MAIN_INLINE(name, 6, args)
#else /* GCC 5 */ #else /* GCC 5 */
# define INTERNAL_SYSCALL_MAIN_6(name, err, arg1, arg2, arg3, \ # define INTERNAL_SYSCALL_MAIN_6(name, arg1, arg2, arg3, \
arg4, arg5, arg6) \ arg4, arg5, arg6) \
struct libc_do_syscall_args _xv = \ struct libc_do_syscall_args _xv = \
{ \ { \
@ -332,22 +332,22 @@ struct libc_do_syscall_args
: "i" (__NR_##name), "c" (arg2), "d" (arg3), "S" (arg4), "D" (&_xv) \ : "i" (__NR_##name), "c" (arg2), "d" (arg3), "S" (arg4), "D" (&_xv) \
: "memory", "cc") : "memory", "cc")
#endif /* GCC 5 */ #endif /* GCC 5 */
#define INTERNAL_SYSCALL(name, err, nr, args...) \ #define INTERNAL_SYSCALL(name, nr, args...) \
({ \ ({ \
register unsigned int resultvar; \ register unsigned int resultvar; \
INTERNAL_SYSCALL_MAIN_##nr (name, err, args); \ INTERNAL_SYSCALL_MAIN_##nr (name, args); \
(int) resultvar; }) (int) resultvar; })
#if I386_USE_SYSENTER #if I386_USE_SYSENTER
# ifdef OPTIMIZE_FOR_GCC_5 # ifdef OPTIMIZE_FOR_GCC_5
# ifdef PIC # ifdef PIC
# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ # define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
LOADREGS_##nr(args) \ LOADREGS_##nr(args) \
asm volatile ( \ asm volatile ( \
"call *%%gs:%P2" \ "call *%%gs:%P2" \
: "=a" (resultvar) \ : "=a" (resultvar) \
: "a" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo)) \ : "a" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo)) \
ASMARGS_##nr(args) : "memory", "cc") ASMARGS_##nr(args) : "memory", "cc")
# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ # define INTERNAL_SYSCALL_NCS(name, nr, args...) \
({ \ ({ \
register unsigned int resultvar; \ register unsigned int resultvar; \
LOADREGS_##nr(args) \ LOADREGS_##nr(args) \
@ -358,13 +358,13 @@ struct libc_do_syscall_args
ASMARGS_##nr(args) : "memory", "cc"); \ ASMARGS_##nr(args) : "memory", "cc"); \
(int) resultvar; }) (int) resultvar; })
# else # else
# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ # define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
LOADREGS_##nr(args) \ LOADREGS_##nr(args) \
asm volatile ( \ asm volatile ( \
"call *_dl_sysinfo" \ "call *_dl_sysinfo" \
: "=a" (resultvar) \ : "=a" (resultvar) \
: "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc") : "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc")
# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ # define INTERNAL_SYSCALL_NCS(name, nr, args...) \
({ \ ({ \
register unsigned int resultvar; \ register unsigned int resultvar; \
LOADREGS_##nr(args) \ LOADREGS_##nr(args) \
@ -376,7 +376,7 @@ struct libc_do_syscall_args
# endif # endif
# else /* GCC 5 */ # else /* GCC 5 */
# ifdef PIC # ifdef PIC
# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ # define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
EXTRAVAR_##nr \ EXTRAVAR_##nr \
asm volatile ( \ asm volatile ( \
LOADARGS_##nr \ LOADARGS_##nr \
@ -386,7 +386,7 @@ struct libc_do_syscall_args
: "=a" (resultvar) \ : "=a" (resultvar) \
: "i" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo)) \ : "i" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo)) \
ASMFMT_##nr(args) : "memory", "cc") ASMFMT_##nr(args) : "memory", "cc")
# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ # define INTERNAL_SYSCALL_NCS(name, nr, args...) \
({ \ ({ \
register unsigned int resultvar; \ register unsigned int resultvar; \
EXTRAVAR_##nr \ EXTRAVAR_##nr \
@ -399,7 +399,7 @@ struct libc_do_syscall_args
ASMFMT_##nr(args) : "memory", "cc"); \ ASMFMT_##nr(args) : "memory", "cc"); \
(int) resultvar; }) (int) resultvar; })
# else # else
# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ # define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
EXTRAVAR_##nr \ EXTRAVAR_##nr \
asm volatile ( \ asm volatile ( \
LOADARGS_##nr \ LOADARGS_##nr \
@ -408,7 +408,7 @@ struct libc_do_syscall_args
RESTOREARGS_##nr \ RESTOREARGS_##nr \
: "=a" (resultvar) \ : "=a" (resultvar) \
: "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc") : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc")
# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ # define INTERNAL_SYSCALL_NCS(name, nr, args...) \
({ \ ({ \
register unsigned int resultvar; \ register unsigned int resultvar; \
EXTRAVAR_##nr \ EXTRAVAR_##nr \
@ -423,13 +423,13 @@ struct libc_do_syscall_args
# endif /* GCC 5 */ # endif /* GCC 5 */
#else #else
# ifdef OPTIMIZE_FOR_GCC_5 # ifdef OPTIMIZE_FOR_GCC_5
# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ # define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
LOADREGS_##nr(args) \ LOADREGS_##nr(args) \
asm volatile ( \ asm volatile ( \
"int $0x80" \ "int $0x80" \
: "=a" (resultvar) \ : "=a" (resultvar) \
: "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc") : "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc")
# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ # define INTERNAL_SYSCALL_NCS(name, nr, args...) \
({ \ ({ \
register unsigned int resultvar; \ register unsigned int resultvar; \
LOADREGS_##nr(args) \ LOADREGS_##nr(args) \
@ -439,7 +439,7 @@ struct libc_do_syscall_args
: "a" (name) ASMARGS_##nr(args) : "memory", "cc"); \ : "a" (name) ASMARGS_##nr(args) : "memory", "cc"); \
(int) resultvar; }) (int) resultvar; })
# else /* GCC 5 */ # else /* GCC 5 */
# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ # define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
EXTRAVAR_##nr \ EXTRAVAR_##nr \
asm volatile ( \ asm volatile ( \
LOADARGS_##nr \ LOADARGS_##nr \
@ -448,7 +448,7 @@ struct libc_do_syscall_args
RESTOREARGS_##nr \ RESTOREARGS_##nr \
: "=a" (resultvar) \ : "=a" (resultvar) \
: "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc") : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc")
# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ # define INTERNAL_SYSCALL_NCS(name, nr, args...) \
({ \ ({ \
register unsigned int resultvar; \ register unsigned int resultvar; \
EXTRAVAR_##nr \ EXTRAVAR_##nr \

View File

@ -43,11 +43,9 @@ __xstat (int vers, const char *name, struct stat *buf)
{ {
struct stat64 buf64; struct stat64 buf64;
INTERNAL_SYSCALL_DECL (err); result = INTERNAL_SYSCALL_CALL (stat64, name, &buf64);
result = INTERNAL_SYSCALL (stat64, err, 2, name, &buf64); if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result)))
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err))) return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result));
return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result,
err));
else else
return __xstat32_conv (vers, &buf64, buf); return __xstat32_conv (vers, &buf64, buf);
} }

View File

@ -112,8 +112,7 @@ __sigstack_longjmp (__jmp_buf buf, int val)
jb_sp = ((unsigned long *) buf)[JB_SP]; jb_sp = ((unsigned long *) buf)[JB_SP];
jb_bsp = ((unsigned long **) buf)[JB_BSP]; jb_bsp = ((unsigned long **) buf)[JB_BSP];
INTERNAL_SYSCALL_DECL (err); INTERNAL_SYSCALL_CALL (sigaltstack, NULL, &stk);
(void) INTERNAL_SYSCALL (sigaltstack, err, 2, NULL, &stk);
ss_sp = (unsigned long) stk.ss_sp; ss_sp = (unsigned long) stk.ss_sp;
jb_rnat_addr = ia64_rse_rnat_addr (jb_bsp); jb_rnat_addr = ia64_rse_rnat_addr (jb_bsp);

View File

@ -192,7 +192,7 @@
#ifdef IA64_USE_NEW_STUB #ifdef IA64_USE_NEW_STUB
# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ # define INTERNAL_SYSCALL_NCS(name, nr, args...) \
({ \ ({ \
LOAD_ARGS_##nr (args) \ LOAD_ARGS_##nr (args) \
register long _r8 __asm ("r8"); \ register long _r8 __asm ("r8"); \
@ -215,7 +215,7 @@
#else /* !IA64_USE_NEW_STUB */ #else /* !IA64_USE_NEW_STUB */
# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ # define INTERNAL_SYSCALL_NCS(name, nr, args...) \
({ \ ({ \
LOAD_ARGS_##nr (args) \ LOAD_ARGS_##nr (args) \
register long _r8 asm ("r8"); \ register long _r8 asm ("r8"); \
@ -232,8 +232,8 @@
#endif /* !IA64_USE_NEW_STUB */ #endif /* !IA64_USE_NEW_STUB */
#define INTERNAL_SYSCALL(name, err, nr, args...) \ #define INTERNAL_SYSCALL(name, nr, args...) \
INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) INTERNAL_SYSCALL_NCS (__NR_##name, nr, ##args)
#define LOAD_ARGS_0() #define LOAD_ARGS_0()
#define LOAD_REGS_0 #define LOAD_REGS_0

View File

@ -244,8 +244,7 @@ void
__netlink_close (struct netlink_handle *h) __netlink_close (struct netlink_handle *h)
{ {
/* Don't modify errno. */ /* Don't modify errno. */
INTERNAL_SYSCALL_DECL (err); INTERNAL_SYSCALL_CALL (close, h->fd);
(void) INTERNAL_SYSCALL (close, err, 1, h->fd);
} }

View File

@ -62,8 +62,7 @@ static const sigset_t sigall_set = {
static inline void static inline void
__libc_signal_block_all (sigset_t *set) __libc_signal_block_all (sigset_t *set)
{ {
INTERNAL_SYSCALL_DECL (err); INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &sigall_set, set,
INTERNAL_SYSCALL_CALL (rt_sigprocmask, err, SIG_BLOCK, &sigall_set, set,
_NSIG / 8); _NSIG / 8);
} }
@ -73,8 +72,7 @@ __libc_signal_block_app (sigset_t *set)
{ {
sigset_t allset = sigall_set; sigset_t allset = sigall_set;
__clear_internal_signals (&allset); __clear_internal_signals (&allset);
INTERNAL_SYSCALL_DECL (err); INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &allset, set,
INTERNAL_SYSCALL_CALL (rt_sigprocmask, err, SIG_BLOCK, &allset, set,
_NSIG / 8); _NSIG / 8);
} }
@ -82,8 +80,7 @@ __libc_signal_block_app (sigset_t *set)
static inline void static inline void
__libc_signal_restore_set (const sigset_t *set) __libc_signal_restore_set (const sigset_t *set)
{ {
INTERNAL_SYSCALL_DECL (err); INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, set, NULL,
INTERNAL_SYSCALL_CALL (rt_sigprocmask, err, SIG_SETMASK, set, NULL,
_NSIG / 8); _NSIG / 8);
} }

View File

@ -22,12 +22,11 @@
static bool static bool
writev_for_fatal (int fd, const struct iovec *iov, size_t niov, size_t total) writev_for_fatal (int fd, const struct iovec *iov, size_t niov, size_t total)
{ {
INTERNAL_SYSCALL_DECL (err);
ssize_t cnt; ssize_t cnt;
do do
cnt = INTERNAL_SYSCALL (writev, err, 3, fd, iov, niov); cnt = INTERNAL_SYSCALL_CALL (writev, fd, iov, niov);
while (INTERNAL_SYSCALL_ERROR_P (cnt, err) while (INTERNAL_SYSCALL_ERROR_P (cnt)
&& INTERNAL_SYSCALL_ERRNO (cnt, err) == EINTR); && INTERNAL_SYSCALL_ERRNO (cnt) == EINTR);
return cnt == total; return cnt == total;
} }
#define WRITEV_FOR_FATAL writev_for_fatal #define WRITEV_FOR_FATAL writev_for_fatal

View File

@ -25,9 +25,8 @@
if ((unsigned long) (sp) < this_sp) \ if ((unsigned long) (sp) < this_sp) \
{ \ { \
stack_t oss; \ stack_t oss; \
INTERNAL_SYSCALL_DECL (err); \ int result = INTERNAL_SYSCALL_CALL (sigaltstack, NULL, &oss); \
int result = INTERNAL_SYSCALL (sigaltstack, err, 2, NULL, &oss); \ if (!INTERNAL_SYSCALL_ERROR_P (result) \
if (!INTERNAL_SYSCALL_ERROR_P (result, err) \
&& ((oss.ss_flags & SS_ONSTACK) == 0 \ && ((oss.ss_flags & SS_ONSTACK) == 0 \
|| ((unsigned long) oss.ss_sp + oss.ss_size \ || ((unsigned long) oss.ss_sp + oss.ss_size \
- (unsigned long) (sp)) < oss.ss_size)) \ - (unsigned long) (sp)) < oss.ss_size)) \

View File

@ -32,8 +32,7 @@ __brk (void *addr)
{ {
void *newbrk; void *newbrk;
INTERNAL_SYSCALL_DECL (err); newbrk = (void *) INTERNAL_SYSCALL_CALL (brk, addr);
newbrk = (void *) INTERNAL_SYSCALL (brk, err, 1, addr);
__curbrk = newbrk; __curbrk = newbrk;
if (newbrk < addr) if (newbrk < addr)

View File

@ -61,6 +61,6 @@ typedef uintmax_t uatomic_max_t;
}) })
# define atomic_full_barrier() \ # define atomic_full_barrier() \
(INTERNAL_SYSCALL (atomic_barrier, , 0), (void) 0) (INTERNAL_SYSCALL_CALL (atomic_barrier), (void) 0)
#endif #endif

View File

@ -36,10 +36,9 @@ __getpagesize (void)
return GLRO(dl_pagesize); return GLRO(dl_pagesize);
#ifdef __NR_getpagesize #ifdef __NR_getpagesize
INTERNAL_SYSCALL_DECL (err); result = INTERNAL_SYSCALL_CALL (getpagesize);
result = INTERNAL_SYSCALL (getpagesize, err, 0);
/* The only possible error is ENOSYS. */ /* The only possible error is ENOSYS. */
if (!INTERNAL_SYSCALL_ERROR_P (result, err)) if (!INTERNAL_SYSCALL_ERROR_P (result))
return result; return result;
#endif #endif

View File

@ -21,6 +21,5 @@
void * void *
__m68k_read_tp (void) __m68k_read_tp (void)
{ {
INTERNAL_SYSCALL_DECL (err); return (void*) INTERNAL_SYSCALL_CALL (get_thread_area);
return (void*) INTERNAL_SYSCALL_CALL (get_thread_area, err);
} }

View File

@ -227,7 +227,7 @@ SYSCALL_ERROR_LABEL: \
normally. It will never touch errno. This returns just what the kernel normally. It will never touch errno. This returns just what the kernel
gave back. */ gave back. */
#undef INTERNAL_SYSCALL #undef INTERNAL_SYSCALL
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ #define INTERNAL_SYSCALL_NCS(name, nr, args...) \
({ unsigned int _sys_result; \ ({ unsigned int _sys_result; \
{ \ { \
/* Load argument values in temporary variables /* Load argument values in temporary variables
@ -243,8 +243,8 @@ SYSCALL_ERROR_LABEL: \
_sys_result = _d0; \ _sys_result = _d0; \
} \ } \
(int) _sys_result; }) (int) _sys_result; })
#define INTERNAL_SYSCALL(name, err, nr, args...) \ #define INTERNAL_SYSCALL(name, nr, args...) \
INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) INTERNAL_SYSCALL_NCS (__NR_##name, nr, ##args)
#define LOAD_ARGS_0() #define LOAD_ARGS_0()
#define LOAD_REGS_0 #define LOAD_REGS_0

View File

@ -30,9 +30,7 @@ weak_alias (__curbrk, ___brk_addr)
int int
__brk (void *addr) __brk (void *addr)
{ {
INTERNAL_SYSCALL_DECL (err); __curbrk = (void *) INTERNAL_SYSCALL_CALL (brk, addr);
__curbrk = (void *) INTERNAL_SYSCALL (brk, err, 1, addr);
if (__curbrk < addr) if (__curbrk < addr)
{ {
__set_errno (ENOMEM); __set_errno (ENOMEM);

View File

@ -169,11 +169,11 @@ SYSCALL_ERROR_LABEL_DCL: \
normally. It will never touch errno. This returns just what the kernel normally. It will never touch errno. This returns just what the kernel
gave back. */ gave back. */
# undef INTERNAL_SYSCALL # undef INTERNAL_SYSCALL
# define INTERNAL_SYSCALL(name, err, nr, args...) \ # define INTERNAL_SYSCALL(name, nr, args...) \
inline_syscall##nr(SYS_ify(name), args) inline_syscall##nr(SYS_ify(name), args)
# undef INTERNAL_SYSCALL_NCS # undef INTERNAL_SYSCALL_NCS
# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ # define INTERNAL_SYSCALL_NCS(name, nr, args...) \
inline_syscall##nr(name, args) inline_syscall##nr(name, args)
# define SYSCALL_CLOBBERS_6 "r11", "r4", "memory" # define SYSCALL_CLOBBERS_6 "r11", "r4", "memory"

View File

@ -30,10 +30,9 @@ weak_alias (__curbrk, ___brk_addr)
int int
__brk (void *addr) __brk (void *addr)
{ {
INTERNAL_SYSCALL_DECL (err);
void *newbrk; void *newbrk;
newbrk = (void *) INTERNAL_SYSCALL (brk, err, 1, addr); newbrk = (void *) INTERNAL_SYSCALL_CALL (brk, addr);
__curbrk = newbrk; __curbrk = newbrk;
if (newbrk < addr) if (newbrk < addr)

View File

@ -95,10 +95,10 @@ union __mips_syscall_return
# include <mips16-syscall.h> # include <mips16-syscall.h>
# define INTERNAL_SYSCALL(name, err, nr, args...) \ # define INTERNAL_SYSCALL(name, nr, args...) \
INTERNAL_SYSCALL_NCS (SYS_ify (name), err, nr, args) INTERNAL_SYSCALL_NCS (SYS_ify (name), nr, args)
# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ # define INTERNAL_SYSCALL_NCS(number, nr, args...) \
({ \ ({ \
union __mips_syscall_return _sc_ret; \ union __mips_syscall_return _sc_ret; \
_sc_ret.val = __mips16_syscall##nr (args, number); \ _sc_ret.val = __mips16_syscall##nr (args, number); \
@ -111,12 +111,12 @@ union __mips_syscall_return
number, err, args) number, err, args)
#else /* !__mips16 */ #else /* !__mips16 */
# define INTERNAL_SYSCALL(name, err, nr, args...) \ # define INTERNAL_SYSCALL(name, nr, args...) \
internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t", \ internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t", \
"IK" (SYS_ify (name)), \ "IK" (SYS_ify (name)), \
SYS_ify (name), err, args) SYS_ify (name), err, args)
# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ # define INTERNAL_SYSCALL_NCS(number, nr, args...) \
internal_syscall##nr (MOVE32 "\t%0, %2\n\t", \ internal_syscall##nr (MOVE32 "\t%0, %2\n\t", \
"r" (__s0), \ "r" (__s0), \
number, err, args) number, err, args)

View File

@ -40,15 +40,14 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
} }
int result; int result;
INTERNAL_SYSCALL_DECL (err);
struct kernel_stat kst; struct kernel_stat kst;
result = INTERNAL_SYSCALL (newfstatat, err, 4, fd, file, &kst, flag); result = INTERNAL_SYSCALL_CALL (newfstatat, fd, file, &kst, flag);
if (!__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1)) if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result)))
return __xstat64_conv (vers, &kst, st); return __xstat64_conv (vers, &kst, st);
else else
{ {
__set_errno (INTERNAL_SYSCALL_ERRNO (result, err)); __set_errno (INTERNAL_SYSCALL_ERRNO (result));
return -1; return -1;
} }
} }

View File

@ -79,18 +79,18 @@ typedef long int __syscall_arg_t;
#endif #endif
#undef INTERNAL_SYSCALL #undef INTERNAL_SYSCALL
#define INTERNAL_SYSCALL(name, err, nr, args...) \ #define INTERNAL_SYSCALL(name, nr, args...) \
internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t", \ internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t", \
"IK" (SYS_ify (name)), \ "IK" (SYS_ify (name)), \
0, err, args) 0, args)
#undef INTERNAL_SYSCALL_NCS #undef INTERNAL_SYSCALL_NCS
#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ #define INTERNAL_SYSCALL_NCS(number, nr, args...) \
internal_syscall##nr (MOVE32 "\t%0, %2\n\t", \ internal_syscall##nr (MOVE32 "\t%0, %2\n\t", \
"r" (__s0), \ "r" (__s0), \
number, err, args) number, args)
#define internal_syscall0(v0_init, input, number, err, dummy...) \ #define internal_syscall0(v0_init, input, number, dummy...) \
({ \ ({ \
long int _sys_result; \ long int _sys_result; \
\ \
@ -112,7 +112,7 @@ typedef long int __syscall_arg_t;
_sys_result; \ _sys_result; \
}) })
#define internal_syscall1(v0_init, input, number, err, arg1) \ #define internal_syscall1(v0_init, input, number, arg1) \
({ \ ({ \
long int _sys_result; \ long int _sys_result; \
\ \
@ -136,7 +136,7 @@ typedef long int __syscall_arg_t;
_sys_result; \ _sys_result; \
}) })
#define internal_syscall2(v0_init, input, number, err, arg1, arg2) \ #define internal_syscall2(v0_init, input, number, arg1, arg2) \
({ \ ({ \
long int _sys_result; \ long int _sys_result; \
\ \
@ -162,8 +162,7 @@ typedef long int __syscall_arg_t;
_sys_result; \ _sys_result; \
}) })
#define internal_syscall3(v0_init, input, number, err, \ #define internal_syscall3(v0_init, input, number, arg1, arg2, arg3) \
arg1, arg2, arg3) \
({ \ ({ \
long int _sys_result; \ long int _sys_result; \
\ \
@ -191,8 +190,8 @@ typedef long int __syscall_arg_t;
_sys_result; \ _sys_result; \
}) })
#define internal_syscall4(v0_init, input, number, err, \ #define internal_syscall4(v0_init, input, number, arg1, arg2, arg3, \
arg1, arg2, arg3, arg4) \ arg4) \
({ \ ({ \
long int _sys_result; \ long int _sys_result; \
\ \
@ -221,8 +220,8 @@ typedef long int __syscall_arg_t;
_sys_result; \ _sys_result; \
}) })
#define internal_syscall5(v0_init, input, number, err, \ #define internal_syscall5(v0_init, input, number, arg1, arg2, arg3, \
arg1, arg2, arg3, arg4, arg5) \ arg4, arg5) \
({ \ ({ \
long int _sys_result; \ long int _sys_result; \
\ \
@ -253,8 +252,8 @@ typedef long int __syscall_arg_t;
_sys_result; \ _sys_result; \
}) })
#define internal_syscall6(v0_init, input, number, err, \ #define internal_syscall6(v0_init, input, number, arg1, arg2, arg3, \
arg1, arg2, arg3, arg4, arg5, arg6) \ arg4, arg5, arg6) \
({ \ ({ \
long int _sys_result; \ long int _sys_result; \
\ \

View File

@ -28,14 +28,13 @@ mq_unlink (const char *name)
if (name[0] != '/') if (name[0] != '/')
return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL);
INTERNAL_SYSCALL_DECL (err); int ret = INTERNAL_SYSCALL_CALL (mq_unlink, name + 1);
int ret = INTERNAL_SYSCALL (mq_unlink, err, 1, name + 1);
/* While unlink can return either EPERM or EACCES, mq_unlink should /* While unlink can return either EPERM or EACCES, mq_unlink should
return just EACCES. */ return just EACCES. */
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (ret, err))) if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (ret)))
{ {
ret = INTERNAL_SYSCALL_ERRNO (ret, err); ret = INTERNAL_SYSCALL_ERRNO (ret);
if (ret == EPERM) if (ret == EPERM)
ret = EACCES; ret = EACCES;
return INLINE_SYSCALL_ERROR_RETURN_VALUE (ret); return INLINE_SYSCALL_ERROR_RETURN_VALUE (ret);

View File

@ -145,7 +145,7 @@
# undef HAVE_INTERNAL_SEND_SYMBOL # undef HAVE_INTERNAL_SEND_SYMBOL
#undef INTERNAL_SYSCALL_RAW #undef INTERNAL_SYSCALL_RAW
#define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \ #define INTERNAL_SYSCALL_RAW(name, nr, args...) \
({ unsigned int _sys_result; \ ({ unsigned int _sys_result; \
{ \ { \
/* Load argument values in temporary variables /* Load argument values in temporary variables
@ -164,12 +164,12 @@
(int) _sys_result; }) (int) _sys_result; })
#undef INTERNAL_SYSCALL #undef INTERNAL_SYSCALL
#define INTERNAL_SYSCALL(name, err, nr, args...) \ #define INTERNAL_SYSCALL(name, nr, args...) \
INTERNAL_SYSCALL_RAW(SYS_ify(name), err, nr, args) INTERNAL_SYSCALL_RAW(SYS_ify(name), nr, args)
#undef INTERNAL_SYSCALL_NCS #undef INTERNAL_SYSCALL_NCS
#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ #define INTERNAL_SYSCALL_NCS(number, nr, args...) \
INTERNAL_SYSCALL_RAW(number, err, nr, args) INTERNAL_SYSCALL_RAW(number, nr, args)
#define LOAD_ARGS_0() #define LOAD_ARGS_0()
#define LOAD_REGS_0 #define LOAD_REGS_0

View File

@ -65,8 +65,7 @@ __close_nocancel_nostatus (int fd)
static inline void static inline void
__writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt) __writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt)
{ {
INTERNAL_SYSCALL_DECL (err); INTERNAL_SYSCALL_CALL (writev, fd, iov, iovcnt);
INTERNAL_SYSCALL_CALL (writev, err, fd, iov, iovcnt);
} }
/* Uncancelable fcntl. */ /* Uncancelable fcntl. */

View File

@ -26,14 +26,13 @@ static inline int
__access_noerrno (const char *pathname, int mode) __access_noerrno (const char *pathname, int mode)
{ {
int res; int res;
INTERNAL_SYSCALL_DECL (err);
#ifdef __NR_access #ifdef __NR_access
res = INTERNAL_SYSCALL_CALL (access, err, pathname, mode); res = INTERNAL_SYSCALL_CALL (access, pathname, mode);
#else #else
res = INTERNAL_SYSCALL_CALL (faccessat, err, AT_FDCWD, pathname, mode); res = INTERNAL_SYSCALL_CALL (faccessat, AT_FDCWD, pathname, mode);
#endif #endif
if (INTERNAL_SYSCALL_ERROR_P (res, err)) if (INTERNAL_SYSCALL_ERROR_P (res))
return INTERNAL_SYSCALL_ERRNO (res, err); return INTERNAL_SYSCALL_ERRNO (res);
return 0; return 0;
} }
@ -41,9 +40,8 @@ static inline int
__kill_noerrno (pid_t pid, int sig) __kill_noerrno (pid_t pid, int sig)
{ {
int res; int res;
INTERNAL_SYSCALL_DECL (err); res = INTERNAL_SYSCALL_CALL (kill, pid, sig);
res = INTERNAL_SYSCALL_CALL (kill, err, pid, sig); if (INTERNAL_SYSCALL_ERROR_P (res))
if (INTERNAL_SYSCALL_ERROR_P (res, err)) return INTERNAL_SYSCALL_ERRNO (res);
return INTERNAL_SYSCALL_ERRNO (res, err);
return 0; return 0;
} }

View File

@ -35,10 +35,9 @@ setup_thread (struct database_dyn *db)
/* Do not try this at home, kids. We play with the SETTID address /* Do not try this at home, kids. We play with the SETTID address
even thought the process is multi-threaded. This can only work even thought the process is multi-threaded. This can only work
since none of the threads ever terminates. */ since none of the threads ever terminates. */
INTERNAL_SYSCALL_DECL (err); int r = INTERNAL_SYSCALL_CALL (set_tid_address,
int r = INTERNAL_SYSCALL (set_tid_address, err, 1,
&db->head->nscd_certainly_running); &db->head->nscd_certainly_running);
if (!INTERNAL_SYSCALL_ERROR_P (r, err)) if (!INTERNAL_SYSCALL_ERROR_P (r))
/* We know the kernel can reset this field when nscd terminates. /* We know the kernel can reset this field when nscd terminates.
So, set the field to a nonzero value which indicates that nscd So, set the field to a nonzero value which indicates that nscd
is certainly running and clients can skip the test. */ is certainly running and clients can skip the test. */

View File

@ -35,15 +35,14 @@ __personality (unsigned long persona)
persona = (unsigned int) persona; persona = (unsigned int) persona;
#endif #endif
INTERNAL_SYSCALL_DECL (err); long int ret = INTERNAL_SYSCALL_CALL (personality, persona);
long ret = INTERNAL_SYSCALL (personality, err, 1, persona);
/* Starting with kernel commit v2.6.29-6609-g11d06b2, the personality syscall /* Starting with kernel commit v2.6.29-6609-g11d06b2, the personality syscall
never fails. However, 32-bit kernels might flag valid values as errors, so never fails. However, 32-bit kernels might flag valid values as errors, so
we need to reverse the error setting. We can't use the raw result as some we need to reverse the error setting. We can't use the raw result as some
arches split the return/error values. */ arches split the return/error values. */
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (ret, err))) if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (ret)))
ret = -INTERNAL_SYSCALL_ERRNO (ret, err); ret = -INTERNAL_SYSCALL_ERRNO (ret);
return ret; return ret;
} }
weak_alias (__personality, personality) weak_alias (__personality, personality)

View File

@ -41,14 +41,13 @@
int int
posix_fadvise (int fd, off_t offset, off_t len, int advise) posix_fadvise (int fd, off_t offset, off_t len, int advise)
{ {
INTERNAL_SYSCALL_DECL (err);
# if defined (__NR_fadvise64) && !defined (__ASSUME_FADVISE64_AS_64_64) # if defined (__NR_fadvise64) && !defined (__ASSUME_FADVISE64_AS_64_64)
int ret = INTERNAL_SYSCALL_CALL (fadvise64, err, fd, int ret = INTERNAL_SYSCALL_CALL (fadvise64, fd,
__ALIGNMENT_ARG SYSCALL_LL (offset), __ALIGNMENT_ARG SYSCALL_LL (offset),
len, advise); len, advise);
# else # else
# ifdef __ASSUME_FADVISE64_64_6ARG # ifdef __ASSUME_FADVISE64_64_6ARG
int ret = INTERNAL_SYSCALL_CALL (fadvise64_64, err, fd, advise, int ret = INTERNAL_SYSCALL_CALL (fadvise64_64, fd, advise,
SYSCALL_LL (offset), SYSCALL_LL (len)); SYSCALL_LL (offset), SYSCALL_LL (len));
# else # else
@ -56,13 +55,13 @@ posix_fadvise (int fd, off_t offset, off_t len, int advise)
# define __NR_fadvise64_64 __NR_fadvise64 # define __NR_fadvise64_64 __NR_fadvise64
# endif # endif
int ret = INTERNAL_SYSCALL_CALL (fadvise64_64, err, fd, int ret = INTERNAL_SYSCALL_CALL (fadvise64_64, fd,
__ALIGNMENT_ARG SYSCALL_LL (offset), __ALIGNMENT_ARG SYSCALL_LL (offset),
SYSCALL_LL (len), advise); SYSCALL_LL (len), advise);
# endif # endif
# endif # endif
if (INTERNAL_SYSCALL_ERROR_P (ret, err)) if (INTERNAL_SYSCALL_ERROR_P (ret))
return INTERNAL_SYSCALL_ERRNO (ret, err); return INTERNAL_SYSCALL_ERRNO (ret);
return 0; return 0;
} }
#endif /* __OFF_T_MATCHES_OFF64_T */ #endif /* __OFF_T_MATCHES_OFF64_T */

View File

@ -40,18 +40,17 @@ libc_hidden_proto (__posix_fadvise64_l64)
int int
__posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise) __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise)
{ {
INTERNAL_SYSCALL_DECL (err);
#ifdef __ASSUME_FADVISE64_64_6ARG #ifdef __ASSUME_FADVISE64_64_6ARG
int ret = INTERNAL_SYSCALL_CALL (fadvise64_64, err, fd, advise, int ret = INTERNAL_SYSCALL_CALL (fadvise64_64, fd, advise,
SYSCALL_LL64 (offset), SYSCALL_LL64 (len)); SYSCALL_LL64 (offset), SYSCALL_LL64 (len));
#else #else
int ret = INTERNAL_SYSCALL_CALL (fadvise64_64, err, fd, int ret = INTERNAL_SYSCALL_CALL (fadvise64_64, fd,
__ALIGNMENT_ARG SYSCALL_LL64 (offset), __ALIGNMENT_ARG SYSCALL_LL64 (offset),
SYSCALL_LL64 (len), advise); SYSCALL_LL64 (len), advise);
#endif #endif
if (!INTERNAL_SYSCALL_ERROR_P (ret, err)) if (!INTERNAL_SYSCALL_ERROR_P (ret))
return 0; return 0;
return INTERNAL_SYSCALL_ERRNO (ret, err); return INTERNAL_SYSCALL_ERRNO (ret);
} }
/* The type of the len argument was changed from size_t to off_t in /* The type of the len argument was changed from size_t to off_t in

View File

@ -26,12 +26,11 @@
int int
posix_fallocate (int fd, __off_t offset, __off_t len) posix_fallocate (int fd, __off_t offset, __off_t len)
{ {
INTERNAL_SYSCALL_DECL (err); int res = INTERNAL_SYSCALL_CALL (fallocate, fd, 0,
int res = INTERNAL_SYSCALL_CALL (fallocate, err, fd, 0,
SYSCALL_LL (offset), SYSCALL_LL (len)); SYSCALL_LL (offset), SYSCALL_LL (len));
if (! INTERNAL_SYSCALL_ERROR_P (res, err)) if (! INTERNAL_SYSCALL_ERROR_P (res))
return 0; return 0;
if (INTERNAL_SYSCALL_ERRNO (res, err) != EOPNOTSUPP) if (INTERNAL_SYSCALL_ERRNO (res) != EOPNOTSUPP)
return INTERNAL_SYSCALL_ERRNO (res, err); return INTERNAL_SYSCALL_ERRNO (res);
return internal_fallocate (fd, offset, len); return internal_fallocate (fd, offset, len);
} }

View File

@ -28,19 +28,12 @@ libc_hidden_proto (__posix_fallocate64_l64)
int int
__posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len) __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
{ {
INTERNAL_SYSCALL_DECL (err); int res = INTERNAL_SYSCALL_CALL (fallocate, fd, 0,
#ifdef INTERNAL_SYSCALL_TYPES
int res = INTERNAL_SYSCALL_TYPES (fallocate, err, 4, int, fd,
int, 0, off_t, offset,
off_t, len);
#else
int res = INTERNAL_SYSCALL_CALL (fallocate, err, fd, 0,
SYSCALL_LL64 (offset), SYSCALL_LL64 (len)); SYSCALL_LL64 (offset), SYSCALL_LL64 (len));
#endif if (! INTERNAL_SYSCALL_ERROR_P (res))
if (! INTERNAL_SYSCALL_ERROR_P (res, err))
return 0; return 0;
if (INTERNAL_SYSCALL_ERRNO (res, err) != EOPNOTSUPP) if (INTERNAL_SYSCALL_ERRNO (res) != EOPNOTSUPP)
return INTERNAL_SYSCALL_ERRNO (res, err); return INTERNAL_SYSCALL_ERRNO (res);
return internal_fallocate64 (fd, offset, len); return internal_fallocate64 (fd, offset, len);
} }
libc_hidden_def (__posix_fallocate64_l64) libc_hidden_def (__posix_fallocate64_l64)

View File

@ -31,7 +31,6 @@ posix_madvise (void *addr, size_t len, int advice)
if (advice == POSIX_MADV_DONTNEED) if (advice == POSIX_MADV_DONTNEED)
return 0; return 0;
INTERNAL_SYSCALL_DECL (err); int result = INTERNAL_SYSCALL_CALL (madvise, addr, len, advice);
int result = INTERNAL_SYSCALL (madvise, err, 3, addr, len, advice); return INTERNAL_SYSCALL_ERRNO (result);
return INTERNAL_SYSCALL_ERRNO (result, err);
} }

View File

@ -105,7 +105,6 @@ __get_timebase_freq (void)
if (vdsop == NULL) if (vdsop == NULL)
return get_timebase_freq_fallback (); return get_timebase_freq_fallback ();
INTERNAL_SYSCALL_DECL (err); return INTERNAL_VSYSCALL_CALL_TYPE (vdsop, uint64_t, 0);
return INTERNAL_VSYSCALL_CALL_TYPE (vdsop, err, uint64_t, 0);
} }
weak_alias (__get_timebase_freq, __ppc_get_timebase_freq) weak_alias (__get_timebase_freq, __ppc_get_timebase_freq)

View File

@ -26,8 +26,7 @@
const fenv_t * const fenv_t *
__fe_mask_env (void) __fe_mask_env (void)
{ {
INTERNAL_SYSCALL_DECL (err); INTERNAL_SYSCALL_CALL (prctl, PR_SET_FPEXC, PR_FP_EXC_DISABLED);
INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC, PR_FP_EXC_DISABLED);
return FE_DFL_ENV; return FE_DFL_ENV;
} }

View File

@ -27,8 +27,7 @@
const fenv_t * const fenv_t *
__fe_nomask_env_priv (void) __fe_nomask_env_priv (void)
{ {
INTERNAL_SYSCALL_DECL (err); INTERNAL_SYSCALL_CALL (prctl, PR_SET_FPEXC, PR_FP_EXC_PRECISE);
INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC, PR_FP_EXC_PRECISE);
return FE_ENABLED_ENV; return FE_ENABLED_ENV;
} }

View File

@ -26,8 +26,7 @@ const fenv_t *
__fe_mask_env (void) __fe_mask_env (void)
{ {
#if defined PR_SET_FPEXC && defined PR_FP_EXC_DISABLED #if defined PR_SET_FPEXC && defined PR_FP_EXC_DISABLED
INTERNAL_SYSCALL_DECL (err); INTERNAL_SYSCALL_CALL (prctl, PR_SET_FPEXC, PR_FP_EXC_DISABLED);
INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC, PR_FP_EXC_DISABLED);
#else #else
__set_errno (ENOSYS); __set_errno (ENOSYS);
#endif #endif

View File

@ -27,8 +27,7 @@ const fenv_t *
__fe_nomask_env_priv (void) __fe_nomask_env_priv (void)
{ {
#if defined PR_SET_FPEXC && defined PR_FP_EXC_PRECISE #if defined PR_SET_FPEXC && defined PR_FP_EXC_PRECISE
INTERNAL_SYSCALL_DECL (err); INTERNAL_SYSCALL_CALL (prctl, PR_SET_FPEXC, PR_FP_EXC_PRECISE);
INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC, PR_FP_EXC_PRECISE);
#else #else
__set_errno (ENOSYS); __set_errno (ENOSYS);
#endif #endif

View File

@ -38,7 +38,7 @@
gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set) 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. */ the negation of the return value in the kernel gets reverted. */
#define INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, type, nr, args...) \ #define INTERNAL_VSYSCALL_CALL_TYPE(funcptr, type, nr, args...) \
({ \ ({ \
register void *r0 __asm__ ("r0"); \ register void *r0 __asm__ ("r0"); \
register long int r3 __asm__ ("r3"); \ register long int r3 __asm__ ("r3"); \
@ -61,12 +61,12 @@
(long int) r0 & (1 << 28) ? -rval : rval; \ (long int) r0 & (1 << 28) ? -rval : rval; \
}) })
#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ #define INTERNAL_VSYSCALL_CALL(funcptr, nr, args...) \
INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, long int, nr, args) INTERNAL_VSYSCALL_CALL_TYPE(funcptr, long int, nr, args)
#undef INTERNAL_SYSCALL #undef INTERNAL_SYSCALL
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ #define INTERNAL_SYSCALL_NCS(name, nr, args...) \
({ \ ({ \
register long int r0 __asm__ ("r0"); \ register long int r0 __asm__ ("r0"); \
register long int r3 __asm__ ("r3"); \ register long int r3 __asm__ ("r3"); \
@ -88,8 +88,8 @@
"cr0", "ctr", "memory"); \ "cr0", "ctr", "memory"); \
r0 & (1 << 28) ? -r3 : r3; \ r0 & (1 << 28) ? -r3 : r3; \
}) })
#define INTERNAL_SYSCALL(name, err, nr, args...) \ #define INTERNAL_SYSCALL(name, nr, args...) \
INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, args) INTERNAL_SYSCALL_NCS (__NR_##name, nr, args)
#if defined(__PPC64__) || defined(__powerpc64__) #if defined(__PPC64__) || defined(__powerpc64__)
# define SYSCALL_ARG_SIZE 8 # define SYSCALL_ARG_SIZE 8

View File

@ -25,6 +25,5 @@
static inline void static inline void
__pthread_initialize_pids (struct pthread *pd) __pthread_initialize_pids (struct pthread *pd)
{ {
INTERNAL_SYSCALL_DECL (err); pd->tid = INTERNAL_SYSCALL_CALL (set_tid_address, &pd->tid);
pd->tid = INTERNAL_SYSCALL_CALL (set_tid_address, err, &pd->tid);
} }

View File

@ -31,11 +31,10 @@ __pthread_getaffinity_new (pthread_t th, size_t cpusetsize, cpu_set_t *cpuset)
{ {
const struct pthread *pd = (const struct pthread *) th; const struct pthread *pd = (const struct pthread *) th;
INTERNAL_SYSCALL_DECL (err); int res = INTERNAL_SYSCALL_CALL (sched_getaffinity, pd->tid,
int res = INTERNAL_SYSCALL (sched_getaffinity, err, 3, pd->tid,
MIN (INT_MAX, cpusetsize), cpuset); MIN (INT_MAX, cpusetsize), cpuset);
if (INTERNAL_SYSCALL_ERROR_P (res, err)) if (INTERNAL_SYSCALL_ERROR_P (res))
return INTERNAL_SYSCALL_ERRNO (res, err); return INTERNAL_SYSCALL_ERRNO (res);
/* Clean the rest of the memory the kernel didn't do. */ /* Clean the rest of the memory the kernel didn't do. */
memset ((char *) cpuset + res, '\0', cpusetsize - res); memset ((char *) cpuset + res, '\0', cpusetsize - res);

View File

@ -48,12 +48,10 @@ __pthread_kill (pthread_t threadid, int signo)
return EINVAL; return EINVAL;
/* We have a special syscall to do the work. */ /* We have a special syscall to do the work. */
INTERNAL_SYSCALL_DECL (err);
pid_t pid = __getpid (); pid_t pid = __getpid ();
int val = INTERNAL_SYSCALL_CALL (tgkill, err, pid, tid, signo); int val = INTERNAL_SYSCALL_CALL (tgkill, pid, tid, signo);
return (INTERNAL_SYSCALL_ERROR_P (val, err) return (INTERNAL_SYSCALL_ERROR_P (val)
? INTERNAL_SYSCALL_ERRNO (val, err) : 0); ? INTERNAL_SYSCALL_ERRNO (val) : 0);
} }
strong_alias (__pthread_kill, pthread_kill) strong_alias (__pthread_kill, pthread_kill)

View File

@ -28,19 +28,18 @@ __pthread_setaffinity_new (pthread_t th, size_t cpusetsize,
const cpu_set_t *cpuset) const cpu_set_t *cpuset)
{ {
const struct pthread *pd = (const struct pthread *) th; const struct pthread *pd = (const struct pthread *) th;
INTERNAL_SYSCALL_DECL (err);
int res; int res;
res = INTERNAL_SYSCALL (sched_setaffinity, err, 3, pd->tid, cpusetsize, res = INTERNAL_SYSCALL_CALL (sched_setaffinity, pd->tid, cpusetsize,
cpuset); cpuset);
#ifdef RESET_VGETCPU_CACHE #ifdef RESET_VGETCPU_CACHE
if (!INTERNAL_SYSCALL_ERROR_P (res, err)) if (!INTERNAL_SYSCALL_ERROR_P (res))
RESET_VGETCPU_CACHE (); RESET_VGETCPU_CACHE ();
#endif #endif
return (INTERNAL_SYSCALL_ERROR_P (res, err) return (INTERNAL_SYSCALL_ERROR_P (res)
? INTERNAL_SYSCALL_ERRNO (res, err) ? INTERNAL_SYSCALL_ERRNO (res)
: 0); : 0);
} }
versioned_symbol (libpthread, __pthread_setaffinity_new, versioned_symbol (libpthread, __pthread_setaffinity_new,

View File

@ -61,12 +61,10 @@ pthread_sigqueue (pthread_t threadid, int signo, const union sigval value)
info.si_value = value; info.si_value = value;
/* We have a special syscall to do the work. */ /* We have a special syscall to do the work. */
INTERNAL_SYSCALL_DECL (err); int val = INTERNAL_SYSCALL_CALL (rt_tgsigqueueinfo, pid, tid, signo,
int val = INTERNAL_SYSCALL_CALL (rt_tgsigqueueinfo, err, pid, tid, signo,
&info); &info);
return (INTERNAL_SYSCALL_ERROR_P (val, err) return (INTERNAL_SYSCALL_ERROR_P (val)
? INTERNAL_SYSCALL_ERRNO (val, err) : 0); ? INTERNAL_SYSCALL_ERRNO (val) : 0);
#else #else
return ENOSYS; return ENOSYS;
#endif #endif

View File

@ -39,11 +39,10 @@ raise (int sig)
sigset_t set; sigset_t set;
__libc_signal_block_app (&set); __libc_signal_block_app (&set);
INTERNAL_SYSCALL_DECL (err); pid_t pid = INTERNAL_SYSCALL_CALL (getpid);
pid_t pid = INTERNAL_SYSCALL (getpid, err, 0); pid_t tid = INTERNAL_SYSCALL_CALL (gettid);
pid_t tid = INTERNAL_SYSCALL (gettid, err, 0);
int ret = INLINE_SYSCALL (tgkill, 3, pid, tid, sig); int ret = INLINE_SYSCALL_CALL (tgkill, pid, tid, sig);
__libc_signal_restore_set (&set); __libc_signal_restore_set (&set);

View File

@ -23,12 +23,11 @@ syscall (long int syscall_number, long int arg1, long int arg2, long int arg3,
long int arg4, long int arg5, long int arg6, long int arg7) long int arg4, long int arg5, long int arg6, long int arg7)
{ {
long int ret; long int ret;
INTERNAL_SYSCALL_DECL (err);
ret = INTERNAL_SYSCALL_NCS (syscall_number, err, 7, arg1, arg2, arg3, arg4, ret = INTERNAL_SYSCALL_NCS (syscall_number, 7, arg1, arg2, arg3, arg4,
arg5, arg6, arg7); arg5, arg6, arg7);
if (INTERNAL_SYSCALL_ERROR_P (ret, err)) if (INTERNAL_SYSCALL_ERROR_P (ret))
return __syscall_error (ret); return __syscall_error (ret);
return ret; return ret;

View File

@ -130,13 +130,13 @@
# 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 INTERNAL_SYSCALL(name, err, nr, args...) \ # define INTERNAL_SYSCALL(name, nr, args...) \
internal_syscall##nr (SYS_ify (name), err, args) internal_syscall##nr (SYS_ify (name), args)
# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ # define INTERNAL_SYSCALL_NCS(number, nr, args...) \
internal_syscall##nr (number, err, args) internal_syscall##nr (number, args)
# define internal_syscall0(number, err, dummy...) \ # define internal_syscall0(number, dummy...) \
({ \ ({ \
long int _sys_result; \ long int _sys_result; \
\ \
@ -153,7 +153,7 @@
_sys_result; \ _sys_result; \
}) })
# define internal_syscall1(number, err, arg0) \ # define internal_syscall1(number, arg0) \
({ \ ({ \
long int _sys_result; \ long int _sys_result; \
long int _arg0 = (long int) (arg0); \ long int _arg0 = (long int) (arg0); \
@ -171,7 +171,7 @@
_sys_result; \ _sys_result; \
}) })
# define internal_syscall2(number, err, arg0, arg1) \ # define internal_syscall2(number, arg0, arg1) \
({ \ ({ \
long int _sys_result; \ long int _sys_result; \
long int _arg0 = (long int) (arg0); \ long int _arg0 = (long int) (arg0); \
@ -191,7 +191,7 @@
_sys_result; \ _sys_result; \
}) })
# define internal_syscall3(number, err, arg0, arg1, arg2) \ # define internal_syscall3(number, arg0, arg1, arg2) \
({ \ ({ \
long int _sys_result; \ long int _sys_result; \
long int _arg0 = (long int) (arg0); \ long int _arg0 = (long int) (arg0); \
@ -213,7 +213,7 @@
_sys_result; \ _sys_result; \
}) })
# define internal_syscall4(number, err, arg0, arg1, arg2, arg3) \ # define internal_syscall4(number, arg0, arg1, arg2, arg3) \
({ \ ({ \
long int _sys_result; \ long int _sys_result; \
long int _arg0 = (long int) (arg0); \ long int _arg0 = (long int) (arg0); \
@ -237,7 +237,7 @@
_sys_result; \ _sys_result; \
}) })
# define internal_syscall5(number, err, arg0, arg1, arg2, arg3, arg4) \ # define internal_syscall5(number, arg0, arg1, arg2, arg3, arg4) \
({ \ ({ \
long int _sys_result; \ long int _sys_result; \
long int _arg0 = (long int) (arg0); \ long int _arg0 = (long int) (arg0); \
@ -263,7 +263,7 @@
_sys_result; \ _sys_result; \
}) })
# define internal_syscall6(number, err, arg0, arg1, arg2, arg3, arg4, arg5) \ # define internal_syscall6(number, arg0, arg1, arg2, arg3, arg4, arg5) \
({ \ ({ \
long int _sys_result; \ long int _sys_result; \
long int _arg0 = (long int) (arg0); \ long int _arg0 = (long int) (arg0); \
@ -292,7 +292,7 @@
_sys_result; \ _sys_result; \
}) })
# define internal_syscall7(number, err, arg0, arg1, arg2, arg3, arg4, arg5, arg6) \ # define internal_syscall7(number, arg0, arg1, arg2, arg3, arg4, arg5, arg6) \
({ \ ({ \
long int _sys_result; \ long int _sys_result; \
long int _arg0 = (long int) (arg0); \ long int _arg0 = (long int) (arg0); \

View File

@ -39,9 +39,8 @@
if (new_sp < cur_sp) \ if (new_sp < cur_sp) \
{ \ { \
stack_t oss; \ stack_t oss; \
INTERNAL_SYSCALL_DECL (err); \ int res = INTERNAL_SYSCALL_CALL (sigaltstack, NULL, &oss); \
int res = INTERNAL_SYSCALL (sigaltstack, err, 2, NULL, &oss); \ if (!INTERNAL_SYSCALL_ERROR_P (res)) \
if (!INTERNAL_SYSCALL_ERROR_P (res, err)) \
{ \ { \
if ((oss.ss_flags & SS_ONSTACK) == 0 \ if ((oss.ss_flags & SS_ONSTACK) == 0 \
|| ((uintptr_t) (oss.ss_sp + oss.ss_size) - new_sp \ || ((uintptr_t) (oss.ss_sp + oss.ss_size) - new_sp \

View File

@ -37,16 +37,15 @@ int
__posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise) __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise)
{ {
struct fadvise64_64_layout parameters; struct fadvise64_64_layout parameters;
INTERNAL_SYSCALL_DECL (err);
parameters.fd = fd; parameters.fd = fd;
parameters.offset = offset; parameters.offset = offset;
parameters.len = len; parameters.len = len;
parameters.advise = advise; parameters.advise = advise;
int ret = INTERNAL_SYSCALL (fadvise64_64, err, 1, &parameters); int ret = INTERNAL_SYSCALL_CALL (fadvise64_64, &parameters);
if (!INTERNAL_SYSCALL_ERROR_P (ret, err)) if (!INTERNAL_SYSCALL_ERROR_P (ret))
return 0; return 0;
return INTERNAL_SYSCALL_ERRNO (ret, err); return INTERNAL_SYSCALL_ERRNO (ret);
} }
#include <shlib-compat.h> #include <shlib-compat.h>

View File

@ -82,6 +82,7 @@
#undef SYSCALL_ERROR_LABEL #undef SYSCALL_ERROR_LABEL
#ifndef PIC #ifndef PIC
# undef SYSCALL_ERROR_LABEL
# define SYSCALL_ERROR_LABEL 0f # define SYSCALL_ERROR_LABEL 0f
# define SYSCALL_ERROR_HANDLER \ # define SYSCALL_ERROR_HANDLER \
0: basr %r1,0; \ 0: basr %r1,0; \
@ -90,6 +91,7 @@
2: .long syscall_error 2: .long syscall_error
#else #else
# if RTLD_PRIVATE_ERRNO # if RTLD_PRIVATE_ERRNO
# undef SYSCALL_ERROR_LABEL
# define SYSCALL_ERROR_LABEL 0f # define SYSCALL_ERROR_LABEL 0f
# define SYSCALL_ERROR_HANDLER \ # define SYSCALL_ERROR_HANDLER \
0: basr %r1,0; \ 0: basr %r1,0; \
@ -105,6 +107,7 @@
# else # else
# define SYSCALL_ERROR_ERRNO errno # define SYSCALL_ERROR_ERRNO errno
# endif # endif
# undef SYSCALL_ERROR_LABEL
# define SYSCALL_ERROR_LABEL 0f # define SYSCALL_ERROR_LABEL 0f
# define SYSCALL_ERROR_HANDLER \ # define SYSCALL_ERROR_HANDLER \
0: lcr %r0,%r2; \ 0: lcr %r0,%r2; \
@ -117,6 +120,7 @@
br %r14; \ br %r14; \
2: .long _GLOBAL_OFFSET_TABLE_-1b 2: .long _GLOBAL_OFFSET_TABLE_-1b
# else # else
# undef SYSCALL_ERROR_LABEL
# define SYSCALL_ERROR_LABEL 0f # define SYSCALL_ERROR_LABEL 0f
# define SYSCALL_ERROR_HANDLER \ # define SYSCALL_ERROR_HANDLER \
0: basr %r1,0; \ 0: basr %r1,0; \

View File

@ -39,9 +39,8 @@
if (new_sp < cur_sp) \ if (new_sp < cur_sp) \
{ \ { \
stack_t oss; \ stack_t oss; \
INTERNAL_SYSCALL_DECL (err); \ int res = INTERNAL_SYSCALL_CALL (sigaltstack, NULL, &oss); \
int res = INTERNAL_SYSCALL (sigaltstack, err, 2, NULL, &oss); \ if (!INTERNAL_SYSCALL_ERROR_P (res)) \
if (!INTERNAL_SYSCALL_ERROR_P (res, err)) \
{ \ { \
if ((oss.ss_flags & SS_ONSTACK) == 0 \ if ((oss.ss_flags & SS_ONSTACK) == 0 \
|| ((uintptr_t) (oss.ss_sp + oss.ss_size) - new_sp \ || ((uintptr_t) (oss.ss_sp + oss.ss_size) - new_sp \

View File

@ -96,10 +96,12 @@
#undef SYSCALL_ERROR_LABEL #undef SYSCALL_ERROR_LABEL
#ifndef PIC #ifndef PIC
# undef SYSCALL_ERROR_LABEL
# define SYSCALL_ERROR_LABEL syscall_error # define SYSCALL_ERROR_LABEL syscall_error
# define SYSCALL_ERROR_HANDLER # define SYSCALL_ERROR_HANDLER
#else #else
# if RTLD_PRIVATE_ERRNO # if RTLD_PRIVATE_ERRNO
# undef SYSCALL_ERROR_LABEL
# define SYSCALL_ERROR_LABEL 0f # define SYSCALL_ERROR_LABEL 0f
# define SYSCALL_ERROR_HANDLER \ # define SYSCALL_ERROR_HANDLER \
0: larl %r1,rtld_errno; \ 0: larl %r1,rtld_errno; \
@ -113,6 +115,7 @@
# else # else
# define SYSCALL_ERROR_ERRNO errno # define SYSCALL_ERROR_ERRNO errno
# endif # endif
# undef SYSCALL_ERROR_LABEL
# define SYSCALL_ERROR_LABEL 0f # define SYSCALL_ERROR_LABEL 0f
# define SYSCALL_ERROR_HANDLER \ # define SYSCALL_ERROR_HANDLER \
0: lcr %r0,%r2; \ 0: lcr %r0,%r2; \
@ -125,6 +128,7 @@
lghi %r2,-1; \ lghi %r2,-1; \
br %r14 br %r14
# else # else
# undef SYSCALL_ERROR_LABEL
# define SYSCALL_ERROR_LABEL 0f # define SYSCALL_ERROR_LABEL 0f
# define SYSCALL_ERROR_HANDLER \ # define SYSCALL_ERROR_HANDLER \
0: larl %r1,_GLOBAL_OFFSET_TABLE_; \ 0: larl %r1,_GLOBAL_OFFSET_TABLE_; \

View File

@ -22,7 +22,7 @@
#define SYS_ify(syscall_name) __NR_##syscall_name #define SYS_ify(syscall_name) __NR_##syscall_name
#undef INTERNAL_SYSCALL_DIRECT #undef INTERNAL_SYSCALL_DIRECT
#define INTERNAL_SYSCALL_DIRECT(name, err, nr, args...) \ #define INTERNAL_SYSCALL_DIRECT(name, nr, args...) \
({ \ ({ \
DECLARGS_##nr(args) \ DECLARGS_##nr(args) \
register long int _ret __asm__("2"); \ register long int _ret __asm__("2"); \
@ -34,7 +34,7 @@
_ret; }) _ret; })
#undef INTERNAL_SYSCALL_SVC0 #undef INTERNAL_SYSCALL_SVC0
#define INTERNAL_SYSCALL_SVC0(name, err, nr, args...) \ #define INTERNAL_SYSCALL_SVC0(name, nr, args...) \
({ \ ({ \
DECLARGS_##nr(args) \ DECLARGS_##nr(args) \
register unsigned long int _nr __asm__("1") = \ register unsigned long int _nr __asm__("1") = \
@ -48,7 +48,7 @@
_ret; }) _ret; })
#undef INTERNAL_SYSCALL_NCS #undef INTERNAL_SYSCALL_NCS
#define INTERNAL_SYSCALL_NCS(no, err, nr, args...) \ #define INTERNAL_SYSCALL_NCS(no, nr, args...) \
({ \ ({ \
DECLARGS_##nr(args) \ DECLARGS_##nr(args) \
register unsigned long int _nr __asm__("1") = (unsigned long int)(no); \ register unsigned long int _nr __asm__("1") = (unsigned long int)(no); \

View File

@ -25,9 +25,8 @@
static inline void static inline void
__safe_fatal (void) __safe_fatal (void)
{ {
INTERNAL_SYSCALL_DECL (err); pid_t self = INTERNAL_SYSCALL_CALL (getpid);
pid_t self = INTERNAL_SYSCALL (getpid, err, 0); INTERNAL_SYSCALL_CALL (kill, self, SIGKILL);
INTERNAL_SYSCALL (kill, err, 2, self, SIGKILL);
} }
#endif /* safe-fatal.h */ #endif /* safe-fatal.h */

View File

@ -288,7 +288,7 @@
register long int r2 asm ("%r2") = (long int) (_arg7) register long int r2 asm ("%r2") = (long int) (_arg7)
#undef INTERNAL_SYSCALL #undef INTERNAL_SYSCALL
#define INTERNAL_SYSCALL(name, err, nr, args...) \ #define INTERNAL_SYSCALL(name, nr, args...) \
({ \ ({ \
unsigned long int resultvar; \ unsigned long int resultvar; \
register long int r3 asm ("%r3") = SYS_ify (name); \ register long int r3 asm ("%r3") = SYS_ify (name); \
@ -302,7 +302,7 @@
(int) resultvar; }) (int) resultvar; })
/* The _NCS variant allows non-constant syscall numbers. */ /* The _NCS variant allows non-constant syscall numbers. */
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ #define INTERNAL_SYSCALL_NCS(name, nr, args...) \
({ \ ({ \
unsigned long int resultvar; \ unsigned long int resultvar; \
register long int r3 asm ("%r3") = (name); \ register long int r3 asm ("%r3") = (name); \

View File

@ -31,15 +31,13 @@ shmat (int shmid, const void *shmaddr, int shmflg)
#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS #ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
return (void*) INLINE_SYSCALL_CALL (shmat, shmid, shmaddr, shmflg); return (void*) INLINE_SYSCALL_CALL (shmat, shmid, shmaddr, shmflg);
#else #else
INTERNAL_SYSCALL_DECL(err);
unsigned long resultvar; unsigned long resultvar;
void *raddr; void *raddr;
resultvar = INTERNAL_SYSCALL_CALL (ipc, err, IPCOP_shmat, shmid, shmflg, resultvar = INTERNAL_SYSCALL_CALL (ipc, IPCOP_shmat, shmid, shmflg,
&raddr, shmaddr); &raddr, shmaddr);
if (INTERNAL_SYSCALL_ERROR_P (resultvar, err)) if (INTERNAL_SYSCALL_ERROR_P (resultvar))
return (void *) INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (resultvar, return (void *) INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (resultvar));
err));
return raddr; return raddr;
#endif #endif

View File

@ -46,14 +46,14 @@
# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" # define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
#undef INTERNAL_SYSCALL #undef INTERNAL_SYSCALL
#define INTERNAL_SYSCALL(name, err, nr, args...) \ #define INTERNAL_SYSCALL(name, nr, args...) \
internal_syscall##nr(__SYSCALL_STRING, err, __NR_##name, args) internal_syscall##nr(__SYSCALL_STRING, __NR_##name, args)
#undef INTERNAL_SYSCALL_NCS #undef INTERNAL_SYSCALL_NCS
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ #define INTERNAL_SYSCALL_NCS(name, nr, args...) \
internal_syscall##nr(__SYSCALL_STRING, err, name, args) internal_syscall##nr(__SYSCALL_STRING, name, args)
#define internal_syscall0(string,err,name,dummy...) \ #define internal_syscall0(string,name,dummy...) \
({ \ ({ \
register long int __g1 __asm__ ("g1") = (name); \ register long int __g1 __asm__ ("g1") = (name); \
register long __o0 __asm__ ("o0"); \ register long __o0 __asm__ ("o0"); \
@ -63,7 +63,7 @@
__o0; \ __o0; \
}) })
#define internal_syscall1(string,err,name,arg1) \ #define internal_syscall1(string,name,arg1) \
({ \ ({ \
long int _arg1 = (long int) (arg1); \ long int _arg1 = (long int) (arg1); \
register long int __g1 __asm__("g1") = (name); \ register long int __g1 __asm__("g1") = (name); \
@ -74,7 +74,7 @@
__o0; \ __o0; \
}) })
#define internal_syscall2(string,err,name,arg1,arg2) \ #define internal_syscall2(string,name,arg1,arg2) \
({ \ ({ \
long int _arg1 = (long int) (arg1); \ long int _arg1 = (long int) (arg1); \
long int _arg2 = (long int) (arg2); \ long int _arg2 = (long int) (arg2); \
@ -87,7 +87,7 @@
__o0; \ __o0; \
}) })
#define internal_syscall3(string,err,name,arg1,arg2,arg3) \ #define internal_syscall3(string,name,arg1,arg2,arg3) \
({ \ ({ \
long int _arg1 = (long int) (arg1); \ long int _arg1 = (long int) (arg1); \
long int _arg2 = (long int) (arg2); \ long int _arg2 = (long int) (arg2); \
@ -103,7 +103,7 @@
__o0; \ __o0; \
}) })
#define internal_syscall4(string,err,name,arg1,arg2,arg3,arg4) \ #define internal_syscall4(string,name,arg1,arg2,arg3,arg4) \
({ \ ({ \
long int _arg1 = (long int) (arg1); \ long int _arg1 = (long int) (arg1); \
long int _arg2 = (long int) (arg2); \ long int _arg2 = (long int) (arg2); \
@ -121,7 +121,7 @@
__o0; \ __o0; \
}) })
#define internal_syscall5(string,err,name,arg1,arg2,arg3,arg4,arg5) \ #define internal_syscall5(string,name,arg1,arg2,arg3,arg4,arg5) \
({ \ ({ \
long int _arg1 = (long int) (arg1); \ long int _arg1 = (long int) (arg1); \
long int _arg2 = (long int) (arg2); \ long int _arg2 = (long int) (arg2); \
@ -141,7 +141,7 @@
__o0; \ __o0; \
}) })
#define internal_syscall6(string,err,name,arg1,arg2,arg3,arg4,arg5,arg6)\ #define internal_syscall6(string,name,arg1,arg2,arg3,arg4,arg5,arg6) \
({ \ ({ \
long int _arg1 = (long int) (arg1); \ long int _arg1 = (long int) (arg1); \
long int _arg2 = (long int) (arg2); \ long int _arg2 = (long int) (arg2); \

View File

@ -22,7 +22,7 @@
#include <ldsodefs.h> #include <ldsodefs.h>
#ifndef INTERNAL_VSYSCALL_CALL #ifndef INTERNAL_VSYSCALL_CALL
# define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ # define INTERNAL_VSYSCALL_CALL(funcptr, nr, args...) \
funcptr (args) funcptr (args)
#endif #endif
@ -30,24 +30,23 @@
({ \ ({ \
__label__ out; \ __label__ out; \
__label__ iserr; \ __label__ iserr; \
INTERNAL_SYSCALL_DECL (sc_err); \
long int sc_ret; \ long int sc_ret; \
\ \
__typeof (GLRO(dl_vdso_##name)) vdsop = GLRO(dl_vdso_##name); \ __typeof (GLRO(dl_vdso_##name)) vdsop = GLRO(dl_vdso_##name); \
if (vdsop != NULL) \ if (vdsop != NULL) \
{ \ { \
sc_ret = INTERNAL_VSYSCALL_CALL (vdsop, sc_err, nr, ##args); \ sc_ret = INTERNAL_VSYSCALL_CALL (vdsop, nr, ##args); \
if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ if (!INTERNAL_SYSCALL_ERROR_P (sc_ret)) \
goto out; \ goto out; \
if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS) \ if (INTERNAL_SYSCALL_ERRNO (sc_ret) != ENOSYS) \
goto iserr; \ goto iserr; \
} \ } \
\ \
sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, ##args); \ sc_ret = INTERNAL_SYSCALL_CALL (name, ##args); \
if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ if (INTERNAL_SYSCALL_ERROR_P (sc_ret)) \
{ \ { \
iserr: \ iserr: \
__set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \ __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret)); \
sc_ret = -1L; \ sc_ret = -1L; \
} \ } \
out: \ out: \

View File

@ -22,11 +22,8 @@
#include <kernel-features.h> #include <kernel-features.h>
#include <errno.h> #include <errno.h>
#undef INTERNAL_SYSCALL_DECL
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
#undef INTERNAL_SYSCALL_ERROR_P #undef INTERNAL_SYSCALL_ERROR_P
#define INTERNAL_SYSCALL_ERROR_P(val, err) \ #define INTERNAL_SYSCALL_ERROR_P(val) \
((unsigned long int) (val) > -4096UL) ((unsigned long int) (val) > -4096UL)
#ifndef SYSCALL_ERROR_LABEL #ifndef SYSCALL_ERROR_LABEL
@ -43,15 +40,14 @@
#undef INLINE_SYSCALL #undef INLINE_SYSCALL
#define INLINE_SYSCALL(name, nr, args...) \ #define INLINE_SYSCALL(name, nr, args...) \
({ \ ({ \
INTERNAL_SYSCALL_DECL (sc_err); \ long int sc_ret = INTERNAL_SYSCALL (name, nr, args); \
long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \ __glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (sc_ret)) \
__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ ? SYSCALL_ERROR_LABEL (INTERNAL_SYSCALL_ERRNO (sc_ret)) \
? SYSCALL_ERROR_LABEL (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)) \
: sc_ret; \ : sc_ret; \
}) })
#undef INTERNAL_SYSCALL_ERRNO #undef INTERNAL_SYSCALL_ERRNO
#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) #define INTERNAL_SYSCALL_ERRNO(val) (-(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.

Some files were not shown because too many files have changed in this diff Show More