diff options
author | H. Peter Anvin <hpa@zytor.com> | 2004-02-09 23:09:09 +0000 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2004-02-09 23:09:09 +0000 |
commit | 0c3b964eceac1cffb3547e84f0294e4e4ed18bcc (patch) | |
tree | d22210386ad6e8479bbef98c683f085402f57c86 | |
parent | 98dc4d6da5760d35b7b747a9029aba80400d927b (diff) | |
download | klibc-0c3b964eceac1cffb3547e84f0294e4e4ed18bcc.tar.gz |
Rename signal() to sysv_signal() to keep people from getting confusedklibc-0.106
Centralize makefile rules to new MRULES file
-rw-r--r-- | MRULES | 41 | ||||
-rw-r--r-- | ash/Makefile | 4 | ||||
-rw-r--r-- | gzip/Makefile | 6 | ||||
-rw-r--r-- | gzip/gzip.c | 14 | ||||
-rw-r--r-- | include/signal.h | 2 | ||||
-rw-r--r-- | ipconfig/MCONFIG | 1 | ||||
-rw-r--r-- | kinit/Makefile | 1 | ||||
-rw-r--r-- | klibc/CAVEATS | 10 | ||||
-rw-r--r-- | klibc/MCONFIG | 38 | ||||
-rw-r--r-- | klibc/Makefile | 2 | ||||
-rw-r--r-- | klibc/include/signal.h | 2 | ||||
-rw-r--r-- | klibc/sysv_signal.c (renamed from klibc/signal.c) | 4 | ||||
-rw-r--r-- | klibc/tests/nfs_no_rpc.c | 2 | ||||
-rw-r--r-- | nfsmount/MCONFIG | 1 | ||||
-rw-r--r-- | utils/Makefile | 1 | ||||
-rw-r--r-- | utils/dd.c | 4 |
16 files changed, 74 insertions, 59 deletions
diff --git a/MRULES b/MRULES new file mode 100644 index 0000000000000..8a8831c3489e3 --- /dev/null +++ b/MRULES @@ -0,0 +1,41 @@ +# -*- makefile -*- +# +# Standard pattern rules +# + +.SUFFIXES: .c .o .a .so .lo .i .S .s .ls .ss .lss + +.c.o: + $(CC) $(CFLAGS) -c -o $@ $< + +.c.i: + $(CC) $(CFLAGS) -E -o $@ $< + +.c.s: + $(CC) $(CFLAGS) -S -o $@ $< + +.S.o: + $(CC) $(CFLAGS) -D__ASSEMBLY__ -c -o $@ $< + +.S.s: + $(CC) $(CFLAGS) -D__ASSEMBLY__ -E -o $@ $< + +.S.lo: + $(CC) $(CFLAGS) $(SOFLAGS) -D__ASSEMBLY__ -c -o $@ $< + +.S.ls: + $(CC) $(CFLAGS) $(SOFLAGS) -D__ASSEMBLY__ -E -o $@ $< + +.s.o: + $(CC) $(CFLAGS) -x assembler -c -o $@ $< + +.ls.lo: + $(CC) $(CFLAGS) $(SOFLAGS) -x assembler -c -o $@ $< + +.c.lo: + $(CC) $(CFLAGS) $(SOFLAGS) -c -o $@ $< + +.c.ls: + $(CC) $(CFLAGS) $(SOFLAGS) -S -o $@ $< + + diff --git a/ash/Makefile b/ash/Makefile index 647eccabc1e7c..4f25b000151cc 100644 --- a/ash/Makefile +++ b/ash/Makefile @@ -18,6 +18,7 @@ OBJ_BUILDINS = b.o eval.o exec.o SRCROOT = .. include ../MCONFIG +include ../MRULES MAKEDEPS = -Wp,-MD,.$(subst /,-,$*).d CFLAGS = $(MAKEDEPS) $(OPTFLAGS) $(REQFLAGS) -DSHELL @@ -30,9 +31,6 @@ CLEANFILES =\ builtins.c builtins.h init.c mkinit mknodes \ nodes.c nodes.h token.def -.c.o: - $(CC) $(CFLAGS) -c -o $@ $< - all: $(PROG) $(PROG).shared $(PROG): $(OBJS) $(LIBS) $(CRT0) diff --git a/gzip/Makefile b/gzip/Makefile index c33794f50d0a1..5b80539ed762c 100644 --- a/gzip/Makefile +++ b/gzip/Makefile @@ -16,13 +16,14 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# $Id: Makefile,v 1.4 2002/08/23 21:06:05 hpa Exp $ +# $Id: Makefile,v 1.5 2004/02/09 23:18:14 hpa Exp $ #### Start of system configuration section. #### SRCROOT = .. include ../MCONFIG include MCONFIG +include ../MRULES #### End of system configuration section. #### @@ -42,9 +43,6 @@ DEFS += -DSUPPORT_ZIP SRCS += $(ZIPSRCS) endif -.c.o: - $(CC) -c $(CFLAGS) $< - all: gzip gunzip zcat gzip.stripped # Actual build-related targets diff --git a/gzip/gzip.c b/gzip/gzip.c index 3d122c9f8f025..9d84110969ca4 100644 --- a/gzip/gzip.c +++ b/gzip/gzip.c @@ -45,7 +45,7 @@ static char *license_msg[] = { */ #ifdef RCSID -static char rcsid[] = "$Id: gzip.c,v 1.1 2002/08/18 00:59:21 hpa Exp $"; +static char rcsid[] = "$Id: gzip.c,v 1.2 2004/02/09 23:18:14 hpa Exp $"; #endif #include <ctype.h> @@ -238,18 +238,18 @@ int main (argc, argv) env = add_envopt(&argc, &argv, OPTIONS_VAR); if (env != NULL) args = argv; - foreground = signal(SIGINT, SIG_IGN) != SIG_IGN; + foreground = sysv_signal(SIGINT, SIG_IGN) != SIG_IGN; if (foreground) { - (void) signal (SIGINT, (sig_type)abort_gzip); + (void) sysv_signal(SIGINT, (sig_type)abort_gzip); } #ifdef SIGTERM - if (signal(SIGTERM, SIG_IGN) != SIG_IGN) { - (void) signal(SIGTERM, (sig_type)abort_gzip); + if (sysv_signal(SIGTERM, SIG_IGN) != SIG_IGN) { + (void) sysv_signal(SIGTERM, (sig_type)abort_gzip); } #endif #ifdef SIGHUP - if (signal(SIGHUP, SIG_IGN) != SIG_IGN) { - (void) signal(SIGHUP, (sig_type)abort_gzip); + if (sysv_signal(SIGHUP, SIG_IGN) != SIG_IGN) { + (void) sysv_signal(SIGHUP, (sig_type)abort_gzip); } #endif diff --git a/include/signal.h b/include/signal.h index f9eebb2a29535..513b4e5a04687 100644 --- a/include/signal.h +++ b/include/signal.h @@ -64,7 +64,7 @@ static __inline__ int sigismember(sigset_t *__set, int __signum) } __extern __sighandler_t __signal(int, __sighandler_t, int); -__extern __sighandler_t signal(int, __sighandler_t); +__extern __sighandler_t sysv_signal(int, __sighandler_t); __extern __sighandler_t bsd_signal(int, __sighandler_t); __extern int sigaction(int, const struct sigaction *, struct sigaction *); __extern int sigprocmask(int, const sigset_t *, sigset_t *); diff --git a/ipconfig/MCONFIG b/ipconfig/MCONFIG index ba4814e8798e9..472f09205986f 100644 --- a/ipconfig/MCONFIG +++ b/ipconfig/MCONFIG @@ -3,5 +3,6 @@ SRCROOT = .. include $(SRCROOT)/MCONFIG +include $(SRCROOT)/MRULES CFLAGS = -Wp,-MD,$(dir $@).$(notdir $@).d $(OPTFLAGS) $(REQFLAGS) -Wstrict-prototypes -Wall -I. diff --git a/kinit/Makefile b/kinit/Makefile index 78b4f5727ec83..b55cf935bb830 100644 --- a/kinit/Makefile +++ b/kinit/Makefile @@ -1,5 +1,6 @@ SRCROOT = .. include $(SRCROOT)/MCONFIG +include $(SRCROOT)/MRULES MAKEDEPS = -Wp,-MD,.$(subst /,-,$*).d CFLAGS = $(MAKEDEPS) $(OPTFLAGS) $(REQFLAGS) -W -Wall \ diff --git a/klibc/CAVEATS b/klibc/CAVEATS index c7131ac367158..5bc11e417934c 100644 --- a/klibc/CAVEATS +++ b/klibc/CAVEATS @@ -49,3 +49,13 @@ theading: klibc is not thread-safe. Consequently, clone() or any of the pthreads functions are not included. + +bsd_signal vs sysv_signal: +-------------------------- + +There is no signal() call, because you never know if you want +Linux/SysV semantics (SA_RESETHAND) or GNU/BSD semantics (SA_RESTART). +The best, in *any* circumstances, is to never use signal() and instead +use sigaction(), but in order to simplify porting you can use either +sysv_signal() or bsd_signal(), depending on what you actually want. + diff --git a/klibc/MCONFIG b/klibc/MCONFIG index a46a98a9dde47..253a9461b7289 100644 --- a/klibc/MCONFIG +++ b/klibc/MCONFIG @@ -5,45 +5,9 @@ SRCROOT = .. include ../MCONFIG +include ../MRULES WARNFLAGS = -W -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Winline CFLAGS = -Wp,-MD,$(dir $*).$(notdir $*).d $(OPTFLAGS) $(REQFLAGS) $(WARNFLAGS) SOFLAGS = -fPIC - -.SUFFIXES: .c .o .a .so .lo .i .S .s .ls .ss .lss - -.c.o: - $(CC) $(CFLAGS) -c -o $@ $< - -.c.i: - $(CC) $(CFLAGS) -E -o $@ $< - -.c.s: - $(CC) $(CFLAGS) -S -o $@ $< - -.S.o: - $(CC) $(CFLAGS) -D__ASSEMBLY__ -c -o $@ $< - -.S.s: - $(CC) $(CFLAGS) -D__ASSEMBLY__ -E -o $@ $< - -.S.lo: - $(CC) $(CFLAGS) $(SOFLAGS) -D__ASSEMBLY__ -c -o $@ $< - -.S.ls: - $(CC) $(CFLAGS) $(SOFLAGS) -D__ASSEMBLY__ -E -o $@ $< - -.s.o: - $(CC) $(CFLAGS) -x assembler -c -o $@ $< - -.ls.lo: - $(CC) $(CFLAGS) $(SOFLAGS) -x assembler -c -o $@ $< - -.c.lo: - $(CC) $(CFLAGS) $(SOFLAGS) -c -o $@ $< - -.c.ls: - $(CC) $(CFLAGS) $(SOFLAGS) -S -o $@ $< - - diff --git a/klibc/Makefile b/klibc/Makefile index 49cd43b6f3687..5ec7f9347fe56 100644 --- a/klibc/Makefile +++ b/klibc/Makefile @@ -22,7 +22,7 @@ LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \ fopen.o fread.o fread2.o fgetc.o fgets.o \ fwrite.o fwrite2.o fputc.o fputs.o puts.o \ sleep.o usleep.o raise.o abort.o assert.o alarm.o pause.o \ - __signal.o signal.o bsd_signal.o siglist.o siglongjmp.o \ + __signal.o sysv_signal.o bsd_signal.o siglist.o siglongjmp.o \ sigaction.o sigpending.o sigprocmask.o sigsuspend.o \ brk.o sbrk.o malloc.o realloc.o calloc.o mmap.o getpagesize.o \ memcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \ diff --git a/klibc/include/signal.h b/klibc/include/signal.h index f9eebb2a29535..513b4e5a04687 100644 --- a/klibc/include/signal.h +++ b/klibc/include/signal.h @@ -64,7 +64,7 @@ static __inline__ int sigismember(sigset_t *__set, int __signum) } __extern __sighandler_t __signal(int, __sighandler_t, int); -__extern __sighandler_t signal(int, __sighandler_t); +__extern __sighandler_t sysv_signal(int, __sighandler_t); __extern __sighandler_t bsd_signal(int, __sighandler_t); __extern int sigaction(int, const struct sigaction *, struct sigaction *); __extern int sigprocmask(int, const sigset_t *, sigset_t *); diff --git a/klibc/signal.c b/klibc/sysv_signal.c index 982d0c659d255..3e55a02bb5130 100644 --- a/klibc/signal.c +++ b/klibc/sysv_signal.c @@ -1,10 +1,10 @@ /* - * signal.c + * sysv_signal.c */ #include <signal.h> -__sighandler_t signal(int signum, __sighandler_t handler) +__sighandler_t sysv_signal(int signum, __sighandler_t handler) { /* Linux/SysV signal() semantics */ return __signal(signum, handler, SA_RESETHAND); diff --git a/klibc/tests/nfs_no_rpc.c b/klibc/tests/nfs_no_rpc.c index 11b9f61fea5f4..5c17706b635c3 100644 --- a/klibc/tests/nfs_no_rpc.c +++ b/klibc/tests/nfs_no_rpc.c @@ -282,7 +282,7 @@ static int do_call(struct sockaddr_in *sin, u_int32_t msg[], u_int32_t rmsg[], int n; int fd; - signal(SIGALRM, timeout); + sysv_signal(SIGALRM, timeout); fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (fd < 0) goto Esocket; diff --git a/nfsmount/MCONFIG b/nfsmount/MCONFIG index ba4814e8798e9..472f09205986f 100644 --- a/nfsmount/MCONFIG +++ b/nfsmount/MCONFIG @@ -3,5 +3,6 @@ SRCROOT = .. include $(SRCROOT)/MCONFIG +include $(SRCROOT)/MRULES CFLAGS = -Wp,-MD,$(dir $@).$(notdir $@).d $(OPTFLAGS) $(REQFLAGS) -Wstrict-prototypes -Wall -I. diff --git a/utils/Makefile b/utils/Makefile index c29bddce38f31..c92e766dd3e3d 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -1,5 +1,6 @@ SRCROOT = .. include ../MCONFIG +include ../MRULES MAKEDEPS = -Wp,-MD,.$(subst /,-,$*).d CFLAGS = $(MAKEDEPS) $(OPTFLAGS) $(REQFLAGS) -W -Wall diff --git a/utils/dd.c b/utils/dd.c index 2451cca897abc..1313c3ab175b7 100644 --- a/utils/dd.c +++ b/utils/dd.c @@ -430,11 +430,11 @@ static int dd(int rd_fd, int wr_fd, struct stats *stats) ret = sigsetjmp(jmp, 1); if (ret == 0) { - signal(SIGINT, sigint_handler); + sysv_signal(SIGINT, sigint_handler); ret = do_dd(rd_fd, wr_fd, stats); } - signal(SIGINT, SIG_DFL); + sysv_signal(SIGINT, SIG_DFL); return ret; } |