From ca9bd30c262ed788486c1d367ad40550e5d806c2 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 5 Jul 2000 19:25:08 +0000 Subject: Many bugfixes, header cleanups, etc. Added abort and glob. It is getting closer... -Erik --- libc/inet/Makefile | 1 - libc/inet/rpc/svc_tcp.c | 4 +--- libc/misc/time/Makefile | 1 - libc/pwd_grp/Makefile | 3 ++- libc/stdio/Makefile | 1 - libc/stdlib/Makefile | 4 ++-- libc/stdlib/abort.c | 53 +++++++++++++++++++++++++++++++++++++++++++++ libc/stdlib/atexit.c | 1 + libc/stdlib/malloc/Makefile | 5 +---- libc/string/Makefile | 1 - libc/termios/Makefile | 1 - 11 files changed, 60 insertions(+), 15 deletions(-) create mode 100644 libc/stdlib/abort.c (limited to 'libc') diff --git a/libc/inet/Makefile b/libc/inet/Makefile index 14afc1763..b73a5499e 100644 --- a/libc/inet/Makefile +++ b/libc/inet/Makefile @@ -22,7 +22,6 @@ gethostbyaddr.o OBJ=$(AOBJ) $(ROBJ) all: $(LIBC) - @$(RM) $(OBJ) $(LIBC): $(LIBC)($(OBJ)) diff --git a/libc/inet/rpc/svc_tcp.c b/libc/inet/rpc/svc_tcp.c index 2f859476b..837e70c82 100644 --- a/libc/inet/rpc/svc_tcp.c +++ b/libc/inet/rpc/svc_tcp.c @@ -41,13 +41,11 @@ static char sccsid[] = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro"; * and a record/tcp stream. */ +#include #include #include #include #include -/*#ifndef linux*/ -extern bool_t abort(); -/*#endif*/ extern errno; /* diff --git a/libc/misc/time/Makefile b/libc/misc/time/Makefile index 7d648f867..2ee2a14e0 100644 --- a/libc/misc/time/Makefile +++ b/libc/misc/time/Makefile @@ -13,7 +13,6 @@ OBJ=localtime.o gmtime.o asctime.o ctime.o asc_conv.o tm_conv.o mktime.o \ localtime_r.o gmtime_r.o asctime_r.o ctime_r.o all: $(LIBC) - @$(RM) $(OBJ) $(LIBC): $(LIBC)($(OBJ)) diff --git a/libc/pwd_grp/Makefile b/libc/pwd_grp/Makefile index 8be9015f1..06f1cb7c1 100644 --- a/libc/pwd_grp/Makefile +++ b/libc/pwd_grp/Makefile @@ -21,10 +21,11 @@ UOBJ=utent.o OBJ=$(POBJ) $(GOBJ) $(UOBJ) all: $(LIBC)($(OBJ)) - @$(RM) $(OBJ) $(LIBC)($(GOBJ)): config-grp.h +$(LIBC): $(LIBC)($(OBJ)) + clean: rm -f *.o libc.a diff --git a/libc/stdio/Makefile b/libc/stdio/Makefile index 1aa8354f4..3357b3a93 100644 --- a/libc/stdio/Makefile +++ b/libc/stdio/Makefile @@ -21,7 +21,6 @@ SOBJ=scanf.o sscanf.o fscanf.o vscanf.o vsscanf.o vfscanf.o OBJ= $(AOBJ) $(POBJ) $(SOBJ) dputs.o all: $(LIBC) - @$(RM) $(OBJ) $(LIBC): $(LIBC)($(OBJ)) diff --git a/libc/stdlib/Makefile b/libc/stdlib/Makefile index 61a82a2d6..2c2d0f5fb 100644 --- a/libc/stdlib/Makefile +++ b/libc/stdlib/Makefile @@ -17,7 +17,8 @@ EOBJ=on_exit.o atexit.o __do_exit.o exit.o GOBJ=atoi.o atol.o ltoa.o ltostr.o \ ctype.o qsort.o bsearch.o rand.o lsearch.o getopt.o \ - itoa.o strtol.o crypt.o sleep.o mkstemp.o mktemp.o + glob.o fnmatch.o itoa.o strtol.o crypt.o sleep.o mkstemp.o \ + mktemp.o UOBJ=getenv.o putenv.o popen.o system.o getcwd.o setenv.o \ execl.o execv.o execlp.o execvp.o execvep.o @@ -31,7 +32,6 @@ OBJ=$(MOBJ) $(EOBJ) $(GOBJ) $(UOBJ) #endif all: $(LIBC) - @$(RM) $(OBJ) $(LIBC): $(LIBC)($(OBJ)) diff --git a/libc/stdlib/abort.c b/libc/stdlib/abort.c new file mode 100644 index 000000000..3d1c75fe0 --- /dev/null +++ b/libc/stdlib/abort.c @@ -0,0 +1,53 @@ +/* Copyright (C) 1991 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 +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +/* Hacked up for uC-Libc by Erik Andersen */ + +#include +#include +#include +#include +#include +#include +#include + +typedef void (*vfuncp) (); +extern vfuncp __cleanup; +extern void _exit __P ((int __status)) __attribute__ ((__noreturn__)); + +/* Cause an abnormal program termination with core-dump. */ +void +abort(void) +{ + sigset_t sigset; + + if (sigemptyset(&sigset) == 0 && + sigaddset(&sigset, SIGABRT) == 0) { + sigprocmask(SIG_UNBLOCK, &sigset, (sigset_t *) NULL); + } + + if (__cleanup) + __cleanup(); + + while (1) + if (raise(SIGABRT)) + /* If we can't signal ourselves, exit. */ + _exit(127); + /* If we signal ourselves and are still alive, + or can't exit, loop forever. */ +} diff --git a/libc/stdlib/atexit.c b/libc/stdlib/atexit.c index 2a82c6edb..7c6a03af8 100644 --- a/libc/stdlib/atexit.c +++ b/libc/stdlib/atexit.c @@ -20,6 +20,7 @@ typedef void (*vfuncp) (); extern vfuncp __cleanup; extern void __do_exit(); +extern void _exit __P ((int __status)) __attribute__ ((__noreturn__)); extern struct exit_table { diff --git a/libc/stdlib/malloc/Makefile b/libc/stdlib/malloc/Makefile index ece276ba3..b3aca377b 100644 --- a/libc/stdlib/malloc/Makefile +++ b/libc/stdlib/malloc/Makefile @@ -10,14 +10,11 @@ LIBC=../libc.a MSRC=alloc.c MOBJ=malloc.o realloc.o free.o calloc.o malloc_dbg.o free_dbg.o calloc_dbg.o -OBJ=$(MOBJ) - CFLAGS=$(ARCH) $(CCFLAGS) $(DEFS) all: $(LIBC) - @$(RM) $(OBJ) -$(LIBC): $(LIBC)($(OBJ)) +$(LIBC): $(LIBC)($(MOBJ)) $(LIBC)($(MOBJ)): $(MSRC) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o diff --git a/libc/string/Makefile b/libc/string/Makefile index a64d0b82b..251948183 100644 --- a/libc/string/Makefile +++ b/libc/string/Makefile @@ -16,7 +16,6 @@ OBJ=$(SOBJ) strpbrk.o strsep.o strstr.o strtok.o strcspn.o \ strspn.o strcasecmp.o strncasecmp.o config.o all: $(LIBC) - @$(RM) $(OBJ) $(LIBC): $(LIBC)($(OBJ)) diff --git a/libc/termios/Makefile b/libc/termios/Makefile index a4ff4b7d9..4ab80e9da 100644 --- a/libc/termios/Makefile +++ b/libc/termios/Makefile @@ -19,7 +19,6 @@ OBJ=$(TOBJ) ttyname.o # ttyname.o all: $(LIBC) - @$(RM) $(OBJ) $(LIBC): $(LIBC)($(OBJ)) -- cgit v1.2.3