about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/arm/sysdep.h12
-rw-r--r--sysdeps/unix/sysv/linux/i386/brk.c6
-rw-r--r--sysdeps/unix/sysv/linux/i386/sigaction.c11
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysdep.h22
-rw-r--r--sysdeps/unix/sysv/linux/i386/system.c5
-rw-r--r--sysdeps/unix/sysv/linux/ia64/sysdep.h14
-rw-r--r--sysdeps/unix/sysv/linux/m68k/brk.c5
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getpagesize.c7
-rw-r--r--sysdeps/unix/sysv/linux/m68k/sysdep.h18
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h16
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h28
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h26
-rw-r--r--sysdeps/unix/sysv/linux/sigwait.c7
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sysdep.h12
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sysdep.h18
15 files changed, 122 insertions, 85 deletions
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