Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make We have required sigaction() for quite a while.



details:   https://anonhg.NetBSD.org/src/rev/8746490d6528
branches:  trunk
changeset: 755374:8746490d6528
user:      sjg <sjg%NetBSD.org@localhost>
date:      Thu Jun 03 15:40:15 2010 +0000

description:
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.

diffstat:

 usr.bin/make/compat.c  |  22 +++++++++++-----------
 usr.bin/make/job.c     |  16 ++++++++--------
 usr.bin/make/main.c    |   8 ++++----
 usr.bin/make/nonints.h |   5 ++++-
 usr.bin/make/util.c    |  33 ++++++---------------------------
 5 files changed, 33 insertions(+), 51 deletions(-)

diffs (243 lines):

diff -r 4ef7d0de30e9 -r 8746490d6528 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Thu Jun 03 14:32:31 2010 +0000
+++ b/usr.bin/make/compat.c     Thu Jun 03 15:40:15 2010 +0000
@@ -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);
diff -r 4ef7d0de30e9 -r 8746490d6528 usr.bin/make/job.c
--- a/usr.bin/make/job.c        Thu Jun 03 14:32:31 2010 +0000
+++ b/usr.bin/make/job.c        Thu Jun 03 15:40:15 2010 +0000
@@ -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);
 }
 
 /*-
diff -r 4ef7d0de30e9 -r 8746490d6528 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Thu Jun 03 14:32:31 2010 +0000
+++ b/usr.bin/make/main.c       Thu Jun 03 15:40:15 2010 +0000
@@ -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
diff -r 4ef7d0de30e9 -r 8746490d6528 usr.bin/make/nonints.h
--- a/usr.bin/make/nonints.h    Thu Jun 03 14:32:31 2010 +0000
+++ b/usr.bin/make/nonints.h    Thu Jun 03 15:40:15 2010 +0000
@@ -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);
diff -r 4ef7d0de30e9 -r 8746490d6528 usr.bin/make/util.c
--- a/usr.bin/make/util.c       Thu Jun 03 14:32:31 2010 +0000
+++ b/usr.bin/make/util.c       Thu Jun 03 15:40:15 2010 +0000
@@ -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>



Home | Main Index | Thread Index | Old Index