From 705ce36d85df6a6ab0f881a89797a5a88bd0422a Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Tue, 16 Jan 2001 10:06:27 +0000 Subject: Added common handling of errno. --- libc/sysdeps/linux/arm/crt0.S | 7 +------ libc/sysdeps/linux/common/Makefile | 2 +- libc/sysdeps/linux/common/errno.c | 8 ++++++++ libc/sysdeps/linux/i386/crt0.S | 7 ------- libc/sysdeps/linux/m68k/Makefile | 2 +- libc/sysdeps/linux/m68k/errno.c | 9 --------- 6 files changed, 11 insertions(+), 24 deletions(-) create mode 100644 libc/sysdeps/linux/common/errno.c delete mode 100644 libc/sysdeps/linux/m68k/errno.c (limited to 'libc/sysdeps/linux') diff --git a/libc/sysdeps/linux/arm/crt0.S b/libc/sysdeps/linux/arm/crt0.S index 3944bd34c..90478fa59 100644 --- a/libc/sysdeps/linux/arm/crt0.S +++ b/libc/sysdeps/linux/arm/crt0.S @@ -53,14 +53,9 @@ _start: .data .align 2 - .global __errno, __environ + .global __environ __environ: .long 0 .weak environ environ = __environ -__errno: .long 0 -.weak errno -errno = __errno - - diff --git a/libc/sysdeps/linux/common/Makefile b/libc/sysdeps/linux/common/Makefile index 3a66e4c2e..46fd22008 100644 --- a/libc/sysdeps/linux/common/Makefile +++ b/libc/sysdeps/linux/common/Makefile @@ -28,7 +28,7 @@ LIBC=$(TOPDIR)libc.a CSRC =closedir.c dirfd.c getdents.c getdnnm.c gethstnm.c getpagesize.c \ isatty.c kernel_version.c mkfifo.c opendir.c readdir.c rewinddir.c \ seekdir.c setegid.c seteuid.c setpgrp.c statfix.c tell.c telldir.c \ - wait.c wait3.c _xmknod.c libc_init.c tcgetatr.c + wait.c wait3.c _xmknod.c libc_init.c errno.c COBJS=$(patsubst %.c,%.o, $(CSRC)) NISRC= _fxstat.c _lxstat.c _xstat.c diff --git a/libc/sysdeps/linux/common/errno.c b/libc/sysdeps/linux/common/errno.c new file mode 100644 index 000000000..418fc933b --- /dev/null +++ b/libc/sysdeps/linux/common/errno.c @@ -0,0 +1,8 @@ +#include + +int errno = 0; + +int * __errno_location ( void ) +{ + return &errno; +} diff --git a/libc/sysdeps/linux/i386/crt0.S b/libc/sysdeps/linux/i386/crt0.S index 08e406cc6..46d77e09d 100644 --- a/libc/sysdeps/linux/i386/crt0.S +++ b/libc/sysdeps/linux/i386/crt0.S @@ -24,7 +24,6 @@ Cambridge, MA 02139, USA. */ */ .global __environ -.global __errno .global _start .global exit .global main @@ -115,9 +114,3 @@ __environ: .align 4 environ = __environ -.data -__errno: - .long 0 -.weak errno -.align 4 -errno = __errno diff --git a/libc/sysdeps/linux/m68k/Makefile b/libc/sysdeps/linux/m68k/Makefile index fd55d7944..12c659a07 100644 --- a/libc/sysdeps/linux/m68k/Makefile +++ b/libc/sysdeps/linux/m68k/Makefile @@ -33,7 +33,7 @@ CRT0_OBJ=$(patsubst %.S,%.o, $(CRT0)) SSRC=setjmp.S # longjmp.S _start.S clone.S SOBJS=$(patsubst %.S,%.o, $(SSRC)) -CSRC=errno.c +CSRC=#errno.c COBJS=$(patsubst %.c,%.o, $(CSRC)) OBJS=$(SOBJS) $(MOBJ) $(COBJS) diff --git a/libc/sysdeps/linux/m68k/errno.c b/libc/sysdeps/linux/m68k/errno.c deleted file mode 100644 index 7c46530d9..000000000 --- a/libc/sysdeps/linux/m68k/errno.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -int errno = 0; - -int * -__errno_location ( void ) -{ - return &errno; -} -- cgit v1.2.3