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.
This commit is contained in:
parent
c48dffd069
commit
945e78bffe
@ -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_Run(Lst targs)
|
||||
|
||||
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);
|
||||
|
@ -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 @@ Job_Init(void)
|
||||
/*
|
||||
* 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 @@ static void JobSigReset(void)
|
||||
{
|
||||
#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 @@ static void JobSigReset(void)
|
||||
DELSIG(SIGWINCH)
|
||||
DELSIG(SIGCONT)
|
||||
#undef DELSIG
|
||||
(void)signal(SIGCHLD, SIG_DFL);
|
||||
(void)bmake_signal(SIGCHLD, SIG_DFL);
|
||||
}
|
||||
|
||||
/*-
|
||||
|
@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\
|
||||
#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 @@ main(int argc, char **argv)
|
||||
debug_file = stderr;
|
||||
|
||||
#ifdef SIGINFO
|
||||
(void)signal(SIGINFO, siginfo);
|
||||
(void)bmake_signal(SIGINFO, siginfo);
|
||||
#endif
|
||||
/*
|
||||
* Set the seed to produce a different random sequence
|
||||
|
@ -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_Dump(GNode *);
|
||||
void Var_ExportVars(void);
|
||||
void Var_Export(char *, int);
|
||||
void Var_UnExport(char *);
|
||||
|
||||
/* util.c */
|
||||
void (*bmake_signal(int, void (*)(int)))(int);
|
||||
|
@ -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 @@ __RCSID("$NetBSD: util.c,v 1.49 2010/05/05 07:05:33 sjg Exp $");
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "make.h"
|
||||
|
||||
@ -231,24 +232,6 @@ random(void)
|
||||
}
|
||||
#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 @@ getwd(char *pathname)
|
||||
} /* 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 @@ signal(int s, void (*a)(int)))(int)
|
||||
else
|
||||
return osa.sa_handler;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(MAKE_NATIVE) && !defined(HAVE_VSNPRINTF)
|
||||
#include <stdarg.h>
|
||||
|
Loading…
Reference in New Issue
Block a user