1 /* Copyright (C) 1991,1992,1993,1994,1995,1996,1997,2000,2002,2004,2005
2 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
22 #include <bits/errno.h>
27 # include <dl-sysdep.h> /* Defines RTLD_PRIVATE_ERRNO. */
30 .globl C_SYMBOL_NAME(errno)
39 #if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
40 /* We translate the system's EWOULDBLOCK error into EAGAIN.
41 The GNU C library always defines EWOULDBLOCK==EAGAIN.
42 EWOULDBLOCK_sys is the original number. */
43 cmpl $EWOULDBLOCK_sys, %eax /* Is it the old EWOULDBLOCK? */
44 jne notb /* Branch if not. */
45 movl $EAGAIN, %eax /* Yes; translate it to EAGAIN. */
50 # ifndef NO_TLS_DIRECT_SEG_REFS
51 movl %eax, %gs:C_SYMBOL_NAME(errno@NTPOFF)
54 movl %eax, C_SYMBOL_NAME(errno@NTPOFF)(%ecx)
56 # elif !defined _LIBC_REENTRANT
57 movl %eax, C_SYMBOL_NAME(errno)
60 PUSH_ERRNO_LOCATION_RETURN
61 call BP_SYM (__errno_location)
62 POP_ERRNO_LOCATION_RETURN
67 /* The caller has pushed %ebx and then set it up to
68 point to the GOT before calling us through the PLT. */
70 movl C_SYMBOL_NAME(errno@GOTNTPOFF)(%ebx), %ecx
72 /* Pop %ebx value saved before jumping here. */
74 # ifndef NO_TLS_DIRECT_SEG_REFS
78 movl %eax, %gs:0(%ecx)
80 # elif RTLD_PRIVATE_ERRNO
81 movl %eax, C_SYMBOL_NAME(rtld_errno@GOTOFF)(%ebx)
83 /* Pop %ebx value saved before jumping here. */
85 # elif !defined _LIBC_REENTRANT
86 movl C_SYMBOL_NAME(errno@GOT)(%ebx), %ecx
88 /* Pop %ebx value saved before jumping here. */
93 PUSH_ERRNO_LOCATION_RETURN
94 call C_SYMBOL_NAME (BP_SYM (__errno_location)@PLT)
95 POP_ERRNO_LOCATION_RETURN
97 /* Pop %ebx value saved before jumping here. */
105 #undef __syscall_error
106 END (__syscall_error)