1 /* Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 2000, 2002, 2004
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 movl %eax, %gs:C_SYMBOL_NAME(errno@NTPOFF)
51 # elif !defined _LIBC_REENTRANT
52 movl %eax, C_SYMBOL_NAME(errno)
55 PUSH_ERRNO_LOCATION_RETURN
56 call BP_SYM (__errno_location)
57 POP_ERRNO_LOCATION_RETURN
62 /* The caller has pushed %ebx and then set it up to
63 point to the GOT before calling us through the PLT. */
65 movl C_SYMBOL_NAME(errno@GOTNTPOFF)(%ebx), %ecx
67 /* Pop %ebx value saved before jumping here. */
69 movl %eax, %gs:0(%ecx)
70 # elif RTLD_PRIVATE_ERRNO
71 movl %eax, C_SYMBOL_NAME(rtld_errno@GOTOFF)(%ebx)
73 /* Pop %ebx value saved before jumping here. */
75 # elif !defined _LIBC_REENTRANT
76 movl C_SYMBOL_NAME(errno@GOT)(%ebx), %ecx
78 /* Pop %ebx value saved before jumping here. */
83 PUSH_ERRNO_LOCATION_RETURN
84 call C_SYMBOL_NAME (BP_SYM (__errno_location)@PLT)
85 POP_ERRNO_LOCATION_RETURN
87 /* Pop %ebx value saved before jumping here. */
95 #undef __syscall_error