Module Name:    src
Committed By:   sjg
Date:           Thu Jun  3 15:40:16 UTC 2010

Modified Files:
        src/usr.bin/make: compat.c job.c main.c nonints.h util.c

Log Message:
We have required sigaction() for quite a while.
Use bmake_signal() - a wrapper around sigaction()
rather than signal() to ensure that signals are handled
consistently.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/usr.bin/make/compat.c
cvs rdiff -u -r1.149 -r1.150 src/usr.bin/make/job.c
cvs rdiff -u -r1.187 -r1.188 src/usr.bin/make/main.c
cvs rdiff -u -r1.58 -r1.59 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/make/util.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.78 src/usr.bin/make/compat.c:1.79
--- src/usr.bin/make/compat.c:1.78	Fri Apr 23 00:18:50 2010
+++ src/usr.bin/make/compat.c	Thu Jun  3 15:40:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.78 2010/04/23 00:18:50 sjg Exp $	*/
+/*	$NetBSD: compat.c,v 1.79 2010/06/03 15:40:15 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.78 2010/04/23 00:18:50 sjg Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.79 2010/06/03 15:40:15 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)compat.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: compat.c,v 1.78 2010/04/23 00:18:50 sjg Exp $");
+__RCSID("$NetBSD: compat.c,v 1.79 2010/06/03 15:40:15 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -641,17 +641,17 @@
 
     Compat_Init();
 
-    if (signal(SIGINT, SIG_IGN) != SIG_IGN) {
-	signal(SIGINT, CompatInterrupt);
+    if (bmake_signal(SIGINT, SIG_IGN) != SIG_IGN) {
+	bmake_signal(SIGINT, CompatInterrupt);
     }
-    if (signal(SIGTERM, SIG_IGN) != SIG_IGN) {
-	signal(SIGTERM, CompatInterrupt);
+    if (bmake_signal(SIGTERM, SIG_IGN) != SIG_IGN) {
+	bmake_signal(SIGTERM, CompatInterrupt);
     }
-    if (signal(SIGHUP, SIG_IGN) != SIG_IGN) {
-	signal(SIGHUP, CompatInterrupt);
+    if (bmake_signal(SIGHUP, SIG_IGN) != SIG_IGN) {
+	bmake_signal(SIGHUP, CompatInterrupt);
     }
-    if (signal(SIGQUIT, SIG_IGN) != SIG_IGN) {
-	signal(SIGQUIT, CompatInterrupt);
+    if (bmake_signal(SIGQUIT, SIG_IGN) != SIG_IGN) {
+	bmake_signal(SIGQUIT, CompatInterrupt);
     }
 
     ENDNode = Targ_FindNode(".END", TARG_CREATE);

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.149 src/usr.bin/make/job.c:1.150
--- src/usr.bin/make/job.c:1.149	Fri Apr 23 00:18:50 2010
+++ src/usr.bin/make/job.c	Thu Jun  3 15:40:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.149 2010/04/23 00:18:50 sjg Exp $	*/
+/*	$NetBSD: job.c,v 1.150 2010/06/03 15:40:15 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: job.c,v 1.149 2010/04/23 00:18:50 sjg Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.150 2010/06/03 15:40:15 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)job.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: job.c,v 1.149 2010/04/23 00:18:50 sjg Exp $");
+__RCSID("$NetBSD: job.c,v 1.150 2010/06/03 15:40:15 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2171,13 +2171,13 @@
     /*
      * Install a SIGCHLD handler.
      */
-    (void)signal(SIGCHLD, JobChildSig);
+    (void)bmake_signal(SIGCHLD, JobChildSig);
     sigaddset(&caught_signals, SIGCHLD);
 
 #define ADDSIG(s,h)				\
-    if (signal(s, SIG_IGN) != SIG_IGN) {	\
+    if (bmake_signal(s, SIG_IGN) != SIG_IGN) {	\
 	sigaddset(&caught_signals, s);		\
-	(void)signal(s, h);			\
+	(void)bmake_signal(s, h);			\
     }
 
     /*
@@ -2218,7 +2218,7 @@
 {
 #define DELSIG(s)					\
     if (sigismember(&caught_signals, s)) {		\
-	(void)signal(s, SIG_DFL);			\
+	(void)bmake_signal(s, SIG_DFL);			\
     }
 
     DELSIG(SIGINT)
@@ -2231,7 +2231,7 @@
     DELSIG(SIGWINCH)
     DELSIG(SIGCONT)
 #undef DELSIG
-    (void)signal(SIGCHLD, SIG_DFL);
+    (void)bmake_signal(SIGCHLD, SIG_DFL);
 }
 
 /*-

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.187 src/usr.bin/make/main.c:1.188
--- src/usr.bin/make/main.c:1.187	Mon May 17 17:01:16 2010
+++ src/usr.bin/make/main.c	Thu Jun  3 15:40:16 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.187 2010/05/17 17:01:16 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.188 2010/06/03 15:40:16 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.187 2010/05/17 17:01:16 christos Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.188 2010/06/03 15:40:16 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
@@ -81,7 +81,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.187 2010/05/17 17:01:16 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.188 2010/06/03 15:40:16 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -779,7 +779,7 @@
 	debug_file = stderr;
 
 #ifdef SIGINFO
-	(void)signal(SIGINFO, siginfo);
+	(void)bmake_signal(SIGINFO, siginfo);
 #endif
 	/*
 	 * Set the seed to produce a different random sequence

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.58 src/usr.bin/make/nonints.h:1.59
--- src/usr.bin/make/nonints.h:1.58	Wed Apr  7 00:11:27 2010
+++ src/usr.bin/make/nonints.h	Thu Jun  3 15:40:16 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.58 2010/04/07 00:11:27 sjg Exp $	*/
+/*	$NetBSD: nonints.h,v 1.59 2010/06/03 15:40:16 sjg Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -195,3 +195,6 @@
 void Var_ExportVars(void);
 void Var_Export(char *, int);
 void Var_UnExport(char *);
+
+/* util.c */
+void (*bmake_signal(int, void (*)(int)))(int);

Index: src/usr.bin/make/util.c
diff -u src/usr.bin/make/util.c:1.49 src/usr.bin/make/util.c:1.50
--- src/usr.bin/make/util.c:1.49	Wed May  5 07:05:33 2010
+++ src/usr.bin/make/util.c	Thu Jun  3 15:40:16 2010
@@ -1,15 +1,15 @@
-/*	$NetBSD: util.c,v 1.49 2010/05/05 07:05:33 sjg Exp $	*/
+/*	$NetBSD: util.c,v 1.50 2010/06/03 15:40:16 sjg Exp $	*/
 
 /*
  * Missing stuff from OS's
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: util.c,v 1.49 2010/05/05 07:05:33 sjg Exp $";
+static char rcsid[] = "$NetBSD: util.c,v 1.50 2010/06/03 15:40:16 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: util.c,v 1.49 2010/05/05 07:05:33 sjg Exp $");
+__RCSID("$NetBSD: util.c,v 1.50 2010/06/03 15:40:16 sjg Exp $");
 #endif
 #endif
 
@@ -18,6 +18,7 @@
 #include <errno.h>
 #include <stdio.h>
 #include <time.h>
+#include <signal.h>
 
 #include "make.h"
 
@@ -231,24 +232,6 @@
 }
 #endif
 
-/* turn into bsd signals */
-void (*
-signal(int s, void (*a)(int)))(int)
-{
-    struct sigvec osv, sv;
-
-    (void)sigvector(s, NULL, &osv);
-    sv = osv;
-    sv.sv_handler = a;
-#ifdef SV_BSDSIG
-    sv.sv_flags = SV_BSDSIG;
-#endif
-
-    if (sigvector(s, &sv, NULL) == -1)
-        return (BADSIG);
-    return (osv.sv_handler);
-}
-
 #if !defined(__hpux__) && !defined(__hpux)
 int
 utimes(char *file, struct timeval tvp[2])
@@ -370,12 +353,9 @@
 } /* end getwd */
 #endif /* __hpux */
 
-#if defined(sun) && (defined(__svr4__) || defined(__SVR4))
-#include <signal.h>
-
-/* turn into bsd signals */
+/* force posix signals */
 void (*
-signal(int s, void (*a)(int)))(int)
+bmake_signal(int s, void (*a)(int)))(int)
 {
     struct sigaction sa, osa;
 
@@ -388,7 +368,6 @@
     else
 	return osa.sa_handler;
 }
-#endif
 
 #if !defined(MAKE_NATIVE) && !defined(HAVE_VSNPRINTF)
 #include <stdarg.h>

Reply via email to