tech-toolchain archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Porting NetBSD make to Interix
On Thu, 13 May 2010 19:45:23 +0000, David Holland writes:
>On Wed, May 12, 2010 at 06:12:00PM -0700, Simon J. Gerraty wrote:
> > The problem is that make is using both sigaction() and signal().
> > On NetBSD this does not matter but on system V'sh systems, it will
> > result in missing SIGCHLD.
> >
> > If you want to build native NetBSD make you will need to edit util.c
> > and add something such that the signal function that wraps sigaction is
> > compiled for your system.
>
>Wouldn't it be a better plan to define a makesignal() or something
>that always calls sigaction?
Thus?
We have required sigaction() for quite a while.
Use bmake_signal() rather than signal() to ensure that
sigaction() is used consistently.
Index: compat.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/compat.c,v
retrieving revision 1.78
diff -u -p -r1.78 compat.c
--- compat.c 23 Apr 2010 00:18:50 -0000 1.78
+++ compat.c 1 Jun 2010 21:13:49 -0000
@@ -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);
Index: job.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/job.c,v
retrieving revision 1.149
diff -u -p -r1.149 job.c
--- job.c 23 Apr 2010 00:18:50 -0000 1.149
+++ job.c 1 Jun 2010 21:13:50 -0000
@@ -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);
}
/*-
Index: main.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/main.c,v
retrieving revision 1.187
diff -u -p -r1.187 main.c
--- main.c 17 May 2010 17:01:16 -0000 1.187
+++ main.c 1 Jun 2010 21:13:50 -0000
@@ -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
Index: nonints.h
===================================================================
RCS file: /cvsroot/src/usr.bin/make/nonints.h,v
retrieving revision 1.58
diff -u -p -r1.58 nonints.h
--- nonints.h 7 Apr 2010 00:11:27 -0000 1.58
+++ nonints.h 1 Jun 2010 21:13:51 -0000
@@ -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);
Index: util.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/util.c,v
retrieving revision 1.49
diff -u -p -r1.49 util.c
--- util.c 5 May 2010 07:05:33 -0000 1.49
+++ util.c 1 Jun 2010 21:13:51 -0000
@@ -18,6 +18,7 @@ __RCSID("$NetBSD: util.c,v 1.49 2010/05/
#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>
Home |
Main Index |
Thread Index |
Old Index