summaryrefslogtreecommitdiffstats
path: root/usr.bin/make/job.c
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2005-05-12 14:43:32 +0000
committerharti <harti@FreeBSD.org>2005-05-12 14:43:32 +0000
commitdfdc1e0f672d6108333eb0feb0440d6386fa092b (patch)
tree333a37dae1e63e44336b219fdceb7cb3b67946f7 /usr.bin/make/job.c
parent00f50de80b1cf3480968e312fb7c6a2de7e02434 (diff)
downloadFreeBSD-src-dfdc1e0f672d6108333eb0feb0440d6386fa092b.zip
FreeBSD-src-dfdc1e0f672d6108333eb0feb0440d6386fa092b.tar.gz
Cleanup main(). Move catching SIGCHLD into job.c. Move unsetenv("ENV")
into job.c. Move retrieving of environment nearer to the place where it is actually used and invert the preprocessor conditionals to use positive logic. Submitted by: Max Okumoto <okumoto@ucsd.edu> (7.236)
Diffstat (limited to 'usr.bin/make/job.c')
-rw-r--r--usr.bin/make/job.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c
index 3e6c482..8b83d33 100644
--- a/usr.bin/make/job.c
+++ b/usr.bin/make/job.c
@@ -522,6 +522,38 @@ static const char *sh_meta = "#=|^(){};&<>*?[]:$`\\\n";
static GNode *curTarg = NULL;
static GNode *ENDNode;
+static void
+catch_child(int sig __unused)
+{
+}
+
+/**
+ */
+void
+Proc_Init()
+{
+ /*
+ * Catch SIGCHLD so that we get kicked out of select() when we
+ * need to look at a child. This is only known to matter for the
+ * -j case (perhaps without -P).
+ *
+ * XXX this is intentionally misplaced.
+ */
+ struct sigaction sa;
+
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = SA_RESTART | SA_NOCLDSTOP;
+ sa.sa_handler = catch_child;
+ sigaction(SIGCHLD, &sa, NULL);
+
+#if DEFSHELL == 2
+ /*
+ * Turn off ENV to make ksh happier.
+ */
+ unsetenv("ENV");
+#endif
+}
+
/**
* Replace the current process.
*/
OpenPOWER on IntegriCloud