From 3fece7a1aafc45f2672510b06365801b909517d3 Mon Sep 17 00:00:00 2001 From: John Birrell Date: Thu, 30 Apr 1998 09:32:48 +0000 Subject: [PATCH] Make cerror thread aware by calling __error() to get a pointer to the thread-specific error variable. This change make libc use the same cerror code that libc_r has been using. --- lib/libc/amd64/sys/cerror.S | 27 +++++---------------------- lib/libc/i386/sys/cerror.S | 27 +++++---------------------- 2 files changed, 10 insertions(+), 44 deletions(-) diff --git a/lib/libc/amd64/sys/cerror.S b/lib/libc/amd64/sys/cerror.S index 2d8f93517e6..d3e74eb9141 100644 --- a/lib/libc/amd64/sys/cerror.S +++ b/lib/libc/amd64/sys/cerror.S @@ -33,21 +33,22 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: cerror.S,v 1.8 1997/02/22 14:59:29 peter Exp $ */ #if defined(SYSLIBC_RCS) && !defined(lint) .text - .asciz "$Id$" + .asciz "$Id: cerror.S,v 1.8 1997/02/22 14:59:29 peter Exp $" #endif /* SYSLIBC_RCS and not lint */ #include "SYS.h" .globl HIDENAME(cerror) -#ifdef _THREAD_SAFE /* - * Threaded version using __error(). + * The __error() function is thread aware. For non-threaded + * programs and the initial threaded in threaded programs, + * it returns a pointer to the global errno variable. */ .globl CNAME(__error) .type CNAME(__error),@function @@ -67,21 +68,3 @@ HIDENAME(cerror): movl $-1,%edx ret -#else /* _THREAD_SAFE */ - /* - * Non-threaded version using global errno. - */ - .globl CNAME(errno) -HIDENAME(cerror): -#ifdef PIC - /* The caller must execute the PIC prologue before jumping to cerror. */ - movl PIC_GOT(CNAME(errno)),%ecx - movl %eax,(%ecx) - PIC_EPILOGUE -#else - movl %eax,CNAME(errno) -#endif - movl $-1,%eax - movl $-1,%edx - ret -#endif /* _THREAD_SAFE */ diff --git a/lib/libc/i386/sys/cerror.S b/lib/libc/i386/sys/cerror.S index 2d8f93517e6..d3e74eb9141 100644 --- a/lib/libc/i386/sys/cerror.S +++ b/lib/libc/i386/sys/cerror.S @@ -33,21 +33,22 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: cerror.S,v 1.8 1997/02/22 14:59:29 peter Exp $ */ #if defined(SYSLIBC_RCS) && !defined(lint) .text - .asciz "$Id$" + .asciz "$Id: cerror.S,v 1.8 1997/02/22 14:59:29 peter Exp $" #endif /* SYSLIBC_RCS and not lint */ #include "SYS.h" .globl HIDENAME(cerror) -#ifdef _THREAD_SAFE /* - * Threaded version using __error(). + * The __error() function is thread aware. For non-threaded + * programs and the initial threaded in threaded programs, + * it returns a pointer to the global errno variable. */ .globl CNAME(__error) .type CNAME(__error),@function @@ -67,21 +68,3 @@ HIDENAME(cerror): movl $-1,%edx ret -#else /* _THREAD_SAFE */ - /* - * Non-threaded version using global errno. - */ - .globl CNAME(errno) -HIDENAME(cerror): -#ifdef PIC - /* The caller must execute the PIC prologue before jumping to cerror. */ - movl PIC_GOT(CNAME(errno)),%ecx - movl %eax,(%ecx) - PIC_EPILOGUE -#else - movl %eax,CNAME(errno) -#endif - movl $-1,%eax - movl $-1,%edx - ret -#endif /* _THREAD_SAFE */