diff options
23 files changed, 183 insertions, 97 deletions
diff --git a/ChangeLog b/ChangeLog index f28cc74168..357bb218f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,35 @@ +2003-01-08 Ulrich Drepper <drepper@redhat.com> + + * sysdeps/unix/sysv/linux/arm/sysdep.h (INTERNAL_SYSCALL, + INTERNAL_SYSCALL_ERROR_P, INTERNAL_SYSCALL_ERRNO): Add err + argument. + (INTERNAL_SYSCALL_DECL): Define. + +2003-01-06 Jakub Jelinek <jakub@redhat.com> + + * sysdeps/unix/sysv/linux/ia64/sysdep.h (INTERNAL_SYSCALL, + INTERNAL_SYSCALL_ERROR_P, INTERNAL_SYSCALL_ERRNO): Add err + argument. + (INTERNAL_SYSCALL_DECL): Define. + * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h: Likewise. + * sysdeps/unix/sysv/linux/sparc/sysdep.h: Likewise. + * sysdeps/unix/sysv/linux/i386/sysdep.h: Likewise. + (INLINE_SYSCALL): Adjust. + * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: Likewise. + * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h: Likewise. + * sysdeps/unix/sysv/linux/m68k/sysdep.h: Likewise. + * sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise. + * elf/dl-misc.c (_dl_debug_vdprintf): Add INTERNAL_SYSCALL_DECL, + add err argument to INTERNAL_SYSCALL* macros. + * sysdeps/unix/sysv/linux/i386/brk.c (__brk): Likewise. + * sysdeps/unix/sysv/linux/i386/system.c (cancel_handler): Likewise. + * sysdeps/unix/sysv/linux/m68k/brk.c (__brk): Likewise. + * sysdeps/unix/sysv/linux/m68k/getpagesize.c (__getpagesize): + Likewise. + * sysdeps/unix/sysv/linux/sigwait.c (do_sigwait): Likewise. + * sysdeps/unix/sysv/linux/i386/sigaction.c (__libc_sigaction): Use + INLINE_SYSCALL instead of INTERNAL_SYSCALL and setting errno. + 2003-01-07 Ulrich Drepper <drepper@redhat.com> Unify symbols in user namespace exported by libc.so and libc.a. diff --git a/elf/dl-misc.c b/elf/dl-misc.c index 2f37675b46..eacd3a440f 100644 --- a/elf/dl-misc.c +++ b/elf/dl-misc.c @@ -248,7 +248,8 @@ _dl_debug_vdprintf (int fd, int tag_p, const char *fmt, va_list arg) /* Finally write the result. */ #ifdef INTERNAL_SYSCALL - INTERNAL_SYSCALL (writev, 3, fd, &iov, niov); + INTERNAL_SYSCALL_DECL (err); + INTERNAL_SYSCALL (writev, err, 3, fd, &iov, niov); #elif RTLD_PRIVATE_ERRNO /* We have to take this lock just to be sure we don't clobber the private errno when it's being used by another thread that cares about it. diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index 89c771ed53..0a6e6a65ff 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,5 +1,10 @@ 2003-01-06 Jakub Jelinek <jakub@redhat.com> + * sysdeps/unix/sysv/linux/sigwait.c (do_sigwait): Add + INTERNAL_SYSCALL_DECL, add err argument to INTERNAL_SYSCALL* macros. + +2003-01-06 Jakub Jelinek <jakub@redhat.com> + * sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h (PSEUDO): Use PSEUDO_PREPARE_ARGS. Fix branch condition after SINGLE_THREAD_P. diff --git a/linuxthreads/sysdeps/unix/sysv/linux/sigwait.c b/linuxthreads/sysdeps/unix/sysv/linux/sigwait.c index c0cfb41753..fdec09455a 100644 --- a/linuxthreads/sysdeps/unix/sysv/linux/sigwait.c +++ b/linuxthreads/sysdeps/unix/sysv/linux/sigwait.c @@ -39,15 +39,16 @@ do_sigwait (const sigset_t *set, int *sig) /* XXX The size argument hopefully will have to be changed to the real size of the user-level sigset_t. */ #ifdef INTERNAL_SYSCALL - ret = INTERNAL_SYSCALL (rt_sigtimedwait, 4, CHECK_SIGSET (set), + INTERNAL_SYSCALL_DECL (err); + ret = INTERNAL_SYSCALL (rt_sigtimedwait, err, 4, CHECK_SIGSET (set), NULL, NULL, _NSIG / 8); - if (! INTERNAL_SYSCALL_ERROR_P (ret)) + if (! INTERNAL_SYSCALL_ERROR_P (ret, err)) { *sig = ret; ret = 0; } else - ret = INTERNAL_SYSCALL_ERRNO (ret); + ret = INTERNAL_SYSCALL_ERRNO (ret, err); #else ret = INLINE_SYSCALL (rt_sigtimedwait, 4, CHECK_SIGSET (set), NULL, NULL, _NSIG / 8); diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 3afa3e6754..2b70a747e3 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,10 @@ +2003-01-06 Jakub Jelinek <jakub@redhat.com> + + * sysdeps/pthread/pthread_sigmask.c (pthread_sigmask): Add + INTERNAL_SYSCALL_DECL, add err argument to INTERNAL_SYSCALL* macros. + * sysdeps/unix/sysv/linux/raise.c (raise): Likewise. + * init.c (__pthread_initialize_minimal_internal): Likewise. + 2003-01-07 Jakub Jelinek <jakub@redhat.com> * pthreadP.h (__pthread_cond_timedwait): Add prototype. diff --git a/nptl/init.c b/nptl/init.c index 6ed65d309e..7704e9f507 100644 --- a/nptl/init.c +++ b/nptl/init.c @@ -172,7 +172,8 @@ __pthread_initialize_minimal_internal (void) /* Minimal initialization of the thread descriptor. */ struct pthread *pd = THREAD_SELF; - pd->tid = INTERNAL_SYSCALL (set_tid_address, 1, &pd->tid); + INTERNAL_SYSCALL_DECL (err); + pd->tid = INTERNAL_SYSCALL (set_tid_address, err, 1, &pd->tid); THREAD_SETMEM (pd, specific[0], &pd->specific_1stblock[0]); THREAD_SETMEM (pd, user_stack, true); if (LLL_LOCK_INITIALIZER != 0) diff --git a/nptl/sysdeps/pthread/pthread_sigmask.c b/nptl/sysdeps/pthread/pthread_sigmask.c index 99ec52baa5..3a3fa351aa 100644 --- a/nptl/sysdeps/pthread/pthread_sigmask.c +++ b/nptl/sysdeps/pthread/pthread_sigmask.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -44,11 +44,12 @@ pthread_sigmask (how, newmask, oldmask) #ifdef INTERNAL_SYSCALL /* We know that realtime signals are available if NPTL is used. */ - int result = INTERNAL_SYSCALL (rt_sigprocmask, 4, how, newmask, oldmask, - _NSIG / 8); + INTERNAL_SYSCALL_DECL (err); + int result = INTERNAL_SYSCALL (rt_sigprocmask, err, 4, how, newmask, + oldmask, _NSIG / 8); - return (INTERNAL_SYSCALL_ERROR_P (result) - ? INTERNAL_SYSCALL_ERRNO (result) + return (INTERNAL_SYSCALL_ERROR_P (result, err) + ? INTERNAL_SYSCALL_ERRNO (result, err) : 0); #else return sigprocmask (how, newmask, oldmask) == -1 ? errno : 0; diff --git a/nptl/sysdeps/unix/sysv/linux/raise.c b/nptl/sysdeps/unix/sysv/linux/raise.c index e152ba9055..24a00b1e4d 100644 --- a/nptl/sysdeps/unix/sysv/linux/raise.c +++ b/nptl/sysdeps/unix/sysv/linux/raise.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -33,7 +33,8 @@ raise (sig) { /* This system call is not supposed to fail. */ #ifdef INTERNAL_SYSCALL - selftid = INTERNAL_SYSCALL (gettid, 0); + INTERNAL_SYSCALL_DECL (err); + selftid = INTERNAL_SYSCALL (gettid, err, 0); #else selftid = INLINE_SYSCALL (gettid, 0); #endif diff --git a/sysdeps/unix/sysv/linux/arm/sysdep.h b/sysdeps/unix/sysv/linux/arm/sysdep.h index e7caaa1480..33ce12342a 100644 --- a/sysdeps/unix/sysv/linux/arm/sysdep.h +++ b/sysdeps/unix/sysv/linux/arm/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992,93,95-99,2000,02 Free Software Foundation, Inc. +/* Copyright (C) 1992, 93, 1995-2000, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995. ARM changes by Philip Blundell, <pjb27@cam.ac.uk>, May 1997. @@ -146,8 +146,11 @@ __local_syscall_error: \ } \ (int) _sys_result; }) +#undef INTERNAL_SYSCALL_DECL +#define INTERNAL_SYSCALL_DECL(err) do { } while (0) + #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, nr, args...) \ +#define INTERNAL_SYSCALL(name, err, nr, args...) \ ({ unsigned int _sys_result; \ { \ register int _a1 asm ("a1"); \ @@ -161,10 +164,11 @@ __local_syscall_error: \ (int) _sys_result; }) #undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val) ((unsigned int) (val) >= 0xfffff001u) +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned int) (val) >= 0xfffff001u) #undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val) (-(val)) +#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) #define LOAD_ARGS_0() #define ASM_ARGS_0 diff --git a/sysdeps/unix/sysv/linux/i386/brk.c b/sysdeps/unix/sysv/linux/i386/brk.c index c71a1fbf08..1d26439ede 100644 --- a/sysdeps/unix/sysv/linux/i386/brk.c +++ b/sysdeps/unix/sysv/linux/i386/brk.c @@ -1,5 +1,5 @@ /* brk system call for Linux/i386. - Copyright (C) 1995, 1996, 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 2000, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -36,7 +36,9 @@ __brk (void *addr) { void *__unbounded newbrk; - newbrk = (void *__unbounded) INTERNAL_SYSCALL (brk, 1, __ptrvalue (addr)); + INTERNAL_SYSCALL_DECL (err); + newbrk = (void *__unbounded) INTERNAL_SYSCALL (brk, err, 1, + __ptrvalue (addr)); __curbrk = newbrk; diff --git a/sysdeps/unix/sysv/linux/i386/sigaction.c b/sysdeps/unix/sysv/linux/i386/sigaction.c index 18a5f1ee65..c2f0a0f5d1 100644 --- a/sysdeps/unix/sysv/linux/i386/sigaction.c +++ b/sysdeps/unix/sysv/linux/i386/sigaction.c @@ -131,15 +131,12 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) k_newact.sa_restorer = &restore; } - result = INTERNAL_SYSCALL (sigaction, 3, sig, - act ? __ptrvalue (&k_newact) : 0, - oact ? __ptrvalue (&k_oldact) : 0); + result = INLINE_SYSCALL (sigaction, 3, sig, + act ? __ptrvalue (&k_newact) : 0, + oact ? __ptrvalue (&k_oldact) : 0); if (result < 0) - { - __set_errno (-result); - return -1; - } + return -1; if (oact) { diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index 25208a00a8..02a78d3514 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992,93,95,96,97,98,99,2000,02 Free Software Foundation, Inc. +/* Copyright (C) 1992,1993,1995-2000,2002,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, <drepper@gnu.org>, August 1995. @@ -313,10 +313,10 @@ asm (".L__X'%ebx = 1\n\t" #undef INLINE_SYSCALL #define INLINE_SYSCALL(name, nr, args...) \ ({ \ - unsigned int resultvar = INTERNAL_SYSCALL (name, nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar), 0)) \ + unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \ + if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0)) \ { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar)); \ + __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \ resultvar = 0xffffffff; \ } \ (int) resultvar; }) @@ -328,7 +328,7 @@ asm (".L__X'%ebx = 1\n\t" #undef INTERNAL_SYSCALL #ifdef I386_USE_SYSENTER # ifdef SHARED -# define INTERNAL_SYSCALL(name, nr, args...) \ +# define INTERNAL_SYSCALL(name, err, nr, args...) \ ({ \ unsigned int resultvar; \ asm volatile ( \ @@ -341,7 +341,7 @@ asm (".L__X'%ebx = 1\n\t" ASMFMT_##nr(args) : "memory", "cc"); \ (int) resultvar; }) # else -# define INTERNAL_SYSCALL(name, nr, args...) \ +# define INTERNAL_SYSCALL(name, err, nr, args...) \ ({ \ unsigned int resultvar; \ asm volatile ( \ @@ -354,7 +354,7 @@ asm (".L__X'%ebx = 1\n\t" (int) resultvar; }) # endif #else -# define INTERNAL_SYSCALL(name, nr, args...) \ +# define INTERNAL_SYSCALL(name, err, nr, args...) \ ({ \ unsigned int resultvar; \ asm volatile ( \ @@ -367,11 +367,15 @@ asm (".L__X'%ebx = 1\n\t" (int) resultvar; }) #endif +#undef INTERNAL_SYSCALL_DECL +#define INTERNAL_SYSCALL_DECL(err) do { } while (0) + #undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val) ((unsigned int) (val) >= 0xfffff001u) +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned int) (val) >= 0xfffff001u) #undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val) (-(val)) +#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) #define LOADARGS_0 #if defined I386_USE_SYSENTER && defined SHARED diff --git a/sysdeps/unix/sysv/linux/i386/system.c b/sysdeps/unix/sysv/linux/i386/system.c index 69eb2cd2ad..a171541790 100644 --- a/sysdeps/unix/sysv/linux/i386/system.c +++ b/sysdeps/unix/sysv/linux/i386/system.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -56,7 +56,8 @@ cancel_handler (void *arg) { pid_t child = *(pid_t *) arg; - INTERNAL_SYSCALL (kill, 2, child, SIGKILL); + INTERNAL_SYSCALL_DECL (err); + INTERNAL_SYSCALL (kill, err, 2, child, SIGKILL); TEMP_FAILURE_RETRY (__waitpid (child, NULL, 0)); diff --git a/sysdeps/unix/sysv/linux/ia64/sysdep.h b/sysdeps/unix/sysv/linux/ia64/sysdep.h index 0189075e1f..07e149e754 100644 --- a/sysdeps/unix/sysv/linux/ia64/sysdep.h +++ b/sysdeps/unix/sysv/linux/ia64/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999. Based on code originally written by David Mosberger-Tang @@ -134,8 +134,11 @@ } \ _retval; }) +#undef INTERNAL_SYSCALL_DECL +#define INTERNAL_SYSCALL_DECL(err) long int err + #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, nr, args...) \ +#define INTERNAL_SYSCALL(name, err, nr, args...) \ ({ \ register long _r8 asm ("r8"); \ register long _r10 asm ("r10"); \ @@ -148,15 +151,14 @@ ASM_ARGS_##nr \ : "memory" ASM_CLOBBERS_##nr); \ _retval = _r8; \ - if (_r10 == -1) \ - _retval = -_retval; \ + err = _r10; \ _retval; }) #undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val) ((unsigned long) (val) >= -4095UL) +#define INTERNAL_SYSCALL_ERROR_P(val, err) (err == -1) #undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val) (-(val)) +#define INTERNAL_SYSCALL_ERRNO(val, err) (val) #define LOAD_ARGS_0() do { } while (0) #define LOAD_ARGS_1(out0) \ diff --git a/sysdeps/unix/sysv/linux/m68k/brk.c b/sysdeps/unix/sysv/linux/m68k/brk.c index 396b97d945..6b2c92852d 100644 --- a/sysdeps/unix/sysv/linux/m68k/brk.c +++ b/sysdeps/unix/sysv/linux/m68k/brk.c @@ -1,5 +1,5 @@ /* brk system call for Linux/m68k. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -33,7 +33,8 @@ __brk (void *addr) { void *newbrk; - newbrk = (void *) INTERNAL_SYSCALL (brk, 1, addr); + INTERNAL_SYSCALL_DECL (err); + newbrk = (void *) INTERNAL_SYSCALL (brk, err, 1, addr); __curbrk = newbrk; if (newbrk < addr) diff --git a/sysdeps/unix/sysv/linux/m68k/getpagesize.c b/sysdeps/unix/sysv/linux/m68k/getpagesize.c index 266d81daed..10a437b06e 100644 --- a/sysdeps/unix/sysv/linux/m68k/getpagesize.c +++ b/sysdeps/unix/sysv/linux/m68k/getpagesize.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2002 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Schwab <schwab@suse.de>. @@ -37,9 +37,10 @@ __getpagesize () return GL(dl_pagesize); #ifdef __NR_getpagesize - result = INTERNAL_SYSCALL (getpagesize, 0); + INTERNAL_SYSCALL_DECL (err); + result = INTERNAL_SYSCALL (getpagesize, err, 0); /* The only possible error is ENOSYS. */ - if (!INTERNAL_SYSCALL_ERROR_P (result)) + if (!INTERNAL_SYSCALL_ERROR_P (result, err)) return result; #endif diff --git a/sysdeps/unix/sysv/linux/m68k/sysdep.h b/sysdeps/unix/sysv/linux/m68k/sysdep.h index e6fea788b6..125c584eb4 100644 --- a/sysdeps/unix/sysv/linux/m68k/sysdep.h +++ b/sysdeps/unix/sysv/linux/m68k/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998, 2000, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Andreas Schwab, <schwab@issan.informatik.uni-dortmund.de>, December 1995. @@ -180,20 +180,23 @@ SYSCALL_ERROR_LABEL: \ call. */ #undef INLINE_SYSCALL #define INLINE_SYSCALL(name, nr, args...) \ - ({ unsigned int _sys_result = INTERNAL_SYSCALL (name, nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result), 0)) \ + ({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args); \ + if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\ { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result)); \ + __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \ _sys_result = (unsigned int) -1; \ } \ (int) _sys_result; }) +#undef INTERNAL_SYSCALL_DECL +#define INTERNAL_SYSCALL_DECL(err) do { } while (0) + /* Define a macro which expands inline into the wrapper code for a system call. This use is for internal calls that do not need to handle errors normally. It will never touch errno. This returns just what the kernel gave back. */ #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, nr, args...) \ +#define INTERNAL_SYSCALL(name, err, nr, args...) \ ({ unsigned int _sys_result; \ { \ LOAD_ARGS_##nr (args) \ @@ -207,10 +210,11 @@ SYSCALL_ERROR_LABEL: \ (int) _sys_result; }) #undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val) ((unsigned int) (val) >= -4095U) +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned int) (val) >= -4095U) #undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val) (-(val)) +#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) #define LOAD_ARGS_0() #define ASM_ARGS_0 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h index 2b3dd03b8d..e2d599c22b 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h @@ -55,7 +55,7 @@ # include <errno.h> /* On powerpc a system call basically clobbers the same registers like a - function call, with the exception of LR (which is needed for the + function call, with the exception of LR (which is needed for the "sc; bnslr" sequence) and CR (where only CR0.SO is clobbered to signal an error return status). */ @@ -99,8 +99,11 @@ gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set) the negation of the return value in the kernel gets reverted. */ +# undef INTERNAL_SYSCALL_DECL +# define INTERNAL_SYSCALL_DECL(err) do { } while (0) + # undef INTERNAL_SYSCALL -# define INTERNAL_SYSCALL(name, nr, args...) \ +# define INTERNAL_SYSCALL(name, err, nr, args...) \ ({ \ register long r0 __asm__ ("r0"); \ register long r3 __asm__ ("r3"); \ @@ -126,12 +129,13 @@ : "cr0", "ctr", "memory"); \ (int) r3; \ }) - + # undef INTERNAL_SYSCALL_ERROR_P -# define INTERNAL_SYSCALL_ERROR_P(val) ((unsigned long) (val) >= 0xfffff001u) - +# define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned long) (val) >= 0xfffff001u) + # undef INTERNAL_SYSCALL_ERRNO -# define INTERNAL_SYSCALL_ERRNO(val) (-(val)) +# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) # define LOADARGS_0(name, dummy) \ r0 = __NR_##name diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h index c26d3f1307..c8d1cdd698 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000,01,02 Free Software Foundation, Inc. +/* Copyright (C) 2000,01,02,03 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. @@ -121,33 +121,37 @@ #undef INLINE_SYSCALL #define INLINE_SYSCALL(name, nr, args...) \ ({ \ - unsigned int err = INTERNAL_SYSCALL (name, nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (err), 0)) \ + unsigned int _ret = INTERNAL_SYSCALL (name, , nr, args); \ + if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_ret, ), 0)) \ { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (err)); \ - err = 0xffffffff; \ + __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, )); \ + _ret = 0xffffffff; \ } \ - (int) err; }) + (int) _ret; }) + +#undef INTERNAL_SYSCALL_DECL +#define INTERNAL_SYSCALL_DECL(err) do { } while (0) #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, nr, args...) \ +#define INTERNAL_SYSCALL(name, err, nr, args...) \ ({ \ DECLARGS_##nr(args) \ - int err; \ + int _ret; \ asm volatile ( \ LOADARGS_##nr \ "svc %b1\n\t" \ "lr %0,%%r2\n\t" \ - : "=d" (err) \ + : "=d" (_ret) \ : "I" (__NR_##name) ASMFMT_##nr \ : "memory", "cc", "2", "3", "4", "5", "6"); \ - (int) err; }) + (int) _ret; }) #undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val) ((unsigned int) (val) >= 0xfffff001u) +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned int) (val) >= 0xfffff001u) #undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val) (-(val)) +#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) #define DECLARGS_0() #define DECLARGS_1(arg1) \ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h index 07285377b0..cea75d004a 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h @@ -115,33 +115,37 @@ #undef INLINE_SYSCALL #define INLINE_SYSCALL(name, nr, args...) \ ({ \ - unsigned int err = INTERNAL_SYSCALL (name, nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (err), 0)) \ + unsigned int _ret = INTERNAL_SYSCALL (name, , nr, args); \ + if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_ret, ), 0)) \ { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (err)); \ - err = -1; \ + __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, )); \ + _ret = -1; \ } \ - (int) err; }) + (int) _ret; }) + +#undef INTERNAL_SYSCALL_DECL +#define INTERNAL_SYSCALL_DECL(err) do { } while (0) #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, nr, args...) \ +#define INTERNAL_SYSCALL(name, err, nr, args...) \ ({ \ DECLARGS_##nr(args) \ - int err; \ + int _ret; \ asm volatile ( \ LOADARGS_##nr \ "svc %b1\n\t" \ "lgr %0,%%r2\n\t" \ - : "=d" (err) \ + : "=d" (_ret) \ : "I" (__NR_##name) ASMFMT_##nr \ : "memory", "cc", "2", "3", "4", "5", "6"); \ - (int) err; }) + (int) _ret; }) #undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val) ((unsigned int) (val) >= 0xfffff001u) +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned int) (val) >= 0xfffff001u) #undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val) (-(val)) +#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) #define DECLARGS_0() #define DECLARGS_1(arg1) \ diff --git a/sysdeps/unix/sysv/linux/sigwait.c b/sysdeps/unix/sysv/linux/sigwait.c index f99c64056f..097d62f9ca 100644 --- a/sysdeps/unix/sysv/linux/sigwait.c +++ b/sysdeps/unix/sysv/linux/sigwait.c @@ -39,15 +39,16 @@ do_sigwait (const sigset_t *set, int *sig) /* XXX The size argument hopefully will have to be changed to the real size of the user-level sigset_t. */ #ifdef INTERNAL_SYSCALL - ret = INTERNAL_SYSCALL (rt_sigtimedwait, 4, CHECK_SIGSET (set), + INTERNAL_SYSCALL_DECL (err); + ret = INTERNAL_SYSCALL (rt_sigtimedwait, err, 4, CHECK_SIGSET (set), NULL, NULL, _NSIG / 8); - if (! INTERNAL_SYSCALL_ERROR_P (ret)) + if (! INTERNAL_SYSCALL_ERROR_P (ret, err)) { *sig = ret; ret = 0; } else - ret = INTERNAL_SYSCALL_ERRNO (ret); + ret = INTERNAL_SYSCALL_ERRNO (ret, err); #else ret = INLINE_SYSCALL (rt_sigtimedwait, 4, CHECK_SIGSET (set), NULL, NULL, _NSIG / 8); diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sysdep.h index cc719b48c3..834edc7ba6 100644 --- a/sysdeps/unix/sysv/linux/sparc/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2002 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2000. @@ -24,15 +24,19 @@ #define INLINE_SYSCALL(name, nr, args...) \ inline_syscall##nr(__SYSCALL_STRING, name, args) +#undef INTERNAL_SYSCALL_DECL +#define INTERNAL_SYSCALL_DECL(err) do { } while (0) + #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, nr, args...) \ +#define INTERNAL_SYSCALL(name, err, nr, args...) \ inline_syscall##nr(__INTERNAL_SYSCALL_STRING, name, args) #undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val) ((unsigned long) (val) >= -515L) +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned long) (val) >= -515L) #undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val) (-(val)) +#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) #define inline_syscall0(string,name,dummy...) \ ({ \ diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h index 5c4c7082d1..7c0ea9e311 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001,02 Free Software Foundation, Inc. +/* Copyright (C) 2001,02,03 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -186,16 +186,19 @@ #undef INLINE_SYSCALL #define INLINE_SYSCALL(name, nr, args...) \ ({ \ - unsigned long resultvar = INTERNAL_SYSCALL (name, nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar), 0)) \ + unsigned long resultvar = INTERNAL_SYSCALL (name, , nr, args); \ + if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0)) \ { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar)); \ + __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \ resultvar = (unsigned long) -1; \ } \ (long) resultvar; }) +#undef INTERNAL_SYSCALL_DECL +#define INTERNAL_SYSCALL_DECL(err) do { } while (0) + #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, nr, args...) \ +#define INTERNAL_SYSCALL(name, err, nr, args...) \ ({ \ unsigned long resultvar; \ LOAD_ARGS_##nr (args) \ @@ -207,10 +210,11 @@ (long) resultvar; }) #undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val) ((unsigned long) (val) >= -4095L) +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned long) (val) >= -4095L) #undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val) (-(val)) +#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) #define LOAD_ARGS_0() #define ASM_ARGS_0 |