update from main archive 960906 libc-960907
authordrepper <drepper>
Sat, 7 Sep 1996 04:10:47 +0000 (04:10 +0000)
committerdrepper <drepper>
Sat, 7 Sep 1996 04:10:47 +0000 (04:10 +0000)
sysdeps/unix/sysv/linux/gnu/types.h
sysdeps/unix/sysv/linux/i386/sysdep.S
sysdeps/unix/sysv/linux/i386/sysdep.h

index abfcb6e..745d2d8 100644 (file)
@@ -70,4 +70,8 @@ typedef __kernel_clock_t __clock_t;
    XPG4 seems to require `unsigned long'.  */
 typedef unsigned long __fd_mask;
 
+#ifdef __USE_SVID
+typedef int key_t;
+#endif
+
 #endif /* gnu/types.h */
index 0130ad0..7d5444d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996 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
@@ -27,26 +27,46 @@ Cambridge, MA 02139, USA.  */
        .globl errno
        .type errno,@object
        .size errno,4
-errno: .space 4
+errno: .zero 4
        .globl _errno
        .type _errno,@object
 _errno = errno /* This name is expected by hj libc.so.5 startup code.  */
        .text
 
-/* The following code is not used at all in the shared library.
-   The PIC system call stubs set errno themselves.  */
+/* The following code is only used in the shared library when we
+   compile the reentrant version.  Otherwise each system call defines
+   each own version.  */
 
-#ifndef        PIC
+#ifndef PIC
 
 /* The syscall stubs jump here when they detect an error.
    The code for Linux is almost identical to the canonical Unix/i386
    code, except that the error number in %eax is negated.  */
 
-.globl __syscall_error
+       .globl  __syscall_error
+       .type   __syscall_error,@function
 __syscall_error:
        negl %eax
 
 #define __syscall_error __syscall_error_1
 #include <sysdeps/unix/i386/sysdep.S>
 
+#endif /* !PIC */
+
+
+#ifdef _LIBC_REENTRANT
+       .globl  __errno_location
+       .type   __errno_location,@function
+__errno_location:
+#ifdef PIC
+       call .L2
+.L2:   popl %ecx
+       addl $_GLOBAL_OFFSET_TABLE_+[.-.L2], %ecx
+       movl errno@GOT(%ecx), %eax
+#else
+       movl $errno, %eax
+#endif
+       ret
+.Lfe1:
+       .size   __errno_location, .Lfe1-__errno_location
 #endif
index c77bbbb..96470a1 100644 (file)
@@ -45,21 +45,44 @@ Cambridge, MA 02139, USA.  */
     testl %eax, %eax;                                                        \
     jl syscall_error;
 
-#ifndef        PIC
+#ifndef PIC
 #define SYSCALL_ERROR_HANDLER  /* Nothing here; code in sysdep.S is used.  */
 #else
 /* Store (- %eax) into errno through the GOT.  */
+#ifdef _LIBC_REENTRANT
 #define SYSCALL_ERROR_HANDLER                                                \
+  .type syscall_error,@function;                                             \
+syscall_error:                                                               \
+  pushl %ebx;                                                                \
+  call 0f;                                                                   \
+0:popl %ebx;                                                                 \
+  xorl %edx, %edx;                                                           \
+  addl $_GLOBAL_OFFSET_TABLE_+[.-0b], %ebx;                                  \
+  subl %eax, %edx;                                                           \
+  movl errno@GOT(%ebx), %ecx;                                                \
+  movl %edx, (%ecx);                                                         \
+  pushl %edx;                                                                \
+  call __errno_location@PLT;                                                 \
+  popl %ecx;                                                                 \
+  popl %ebx;                                                                 \
+  movl %ecx, (%eax);                                                         \
+  movl $-1, %eax;                                                            \
+  ret;
+#else
+#define SYSCALL_ERROR_HANDLER                                                \
+  .type syscall_error,@function;                                             \
 syscall_error:                                                               \
   call 0f;                                                                   \
 0:popl %ecx;                                                                 \
-  negl %eax;                                                                 \
+  xorl %edx, %edx;                                                           \
   addl $_GLOBAL_OFFSET_TABLE_+[.-0b], %ecx;                                  \
+  subl %eax, %edx;                                                           \
   movl errno@GOT(%ecx), %ecx;                                                \
-  movl %eax, (%ecx);                                                         \
+  movl %edx, (%ecx);                                                         \
   movl $-1, %eax;                                                            \
   ret;
-#endif
+#endif /* _LIBC_REENTRANT */
+#endif /* PIC */
 
 /* Linux takes system call arguments in registers: