(INTERNAL_SYSCALL, INTERNAL_SYSCALL_ERROR_P, INTERNAL_SYSCALL_ERRNO):
authordrepper <drepper>
Thu, 9 Jan 2003 04:09:24 +0000 (04:09 +0000)
committerdrepper <drepper>
Thu, 9 Jan 2003 04:09:24 +0000 (04:09 +0000)
Add err argument.
(INTERNAL_SYSCALL_DECL): Define.

sysdeps/unix/sysv/linux/arm/sysdep.h
sysdeps/unix/sysv/linux/i386/sysdep.h
sysdeps/unix/sysv/linux/ia64/sysdep.h
sysdeps/unix/sysv/linux/m68k/sysdep.h
sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
sysdeps/unix/sysv/linux/sparc/sysdep.h
sysdeps/unix/sysv/linux/x86_64/sysdep.h

index e7caaa1..33ce123 100644 (file)
@@ -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
index 25208a0..02a78d3 100644 (file)
@@ -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
index 0189075..07e149e 100644 (file)
@@ -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
       }                                                                \
     _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");                            \
                        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)                              \
index e6fea78..125c584 100644 (file)
@@ -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
index 2b3dd03..e2d599c 100644 (file)
@@ -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).  */
 
    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");                                  \
        : "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
index c26d3f1..c8d1cdd 100644 (file)
@@ -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.
 
 #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) \
index 0728537..cea75d0 100644 (file)
 #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) \
index cc719b4..834edc7 100644 (file)
@@ -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.
 
 #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...)                          \
 ({                                                                     \
index 5c4c708..7c0ea9e 100644 (file)
@@ -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
 #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)                                                    \
     (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