diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2012-10-04 13:20:47 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2012-10-04 13:20:47 +0000 |
commit | 6573209291d93ea765708d799c08a5a75a49dfb4 (patch) | |
tree | 774b70f27cc4e76c5c86f91f83958c8c137efa15 | |
parent | f1b4b7da940d5f2b80e86f4f4e0cc1d6b21fea3e (diff) |
backout pgroup/job control from make, there is something deeply bogus
in stdin interaction.
Fixes update-patches as reported by aja...
-rw-r--r-- | usr.bin/make/engine.c | 4 | ||||
-rw-r--r-- | usr.bin/make/job.c | 26 |
2 files changed, 21 insertions, 9 deletions
diff --git a/usr.bin/make/engine.c b/usr.bin/make/engine.c index f6908b9f2d1..db622180df5 100644 --- a/usr.bin/make/engine.c +++ b/usr.bin/make/engine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: engine.c,v 1.34 2012/10/02 10:29:30 espie Exp $ */ +/* $OpenBSD: engine.c,v 1.35 2012/10/04 13:20:46 espie Exp $ */ /* * Copyright (c) 2012 Marc Espie. * @@ -730,8 +730,6 @@ do_run_command(Job *job) Punt("Could not fork"); /*NOTREACHED*/ case 0: - /* place ourselves in a different process group */ - setpgid(0, 0); /* put a random delay unless we're the only job running * and there's nothing left to do. */ diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c index 3d5628e75e4..fab39a6dc82 100644 --- a/usr.bin/make/job.c +++ b/usr.bin/make/job.c @@ -1,4 +1,4 @@ -/* $OpenBSD: job.c,v 1.126 2012/10/02 10:29:30 espie Exp $ */ +/* $OpenBSD: job.c,v 1.127 2012/10/04 13:20:46 espie Exp $ */ /* $NetBSD: job.c,v 1.16 1996/11/06 17:59:08 christos Exp $ */ /* @@ -158,6 +158,23 @@ static void setup_signal(int); static void notice_signal(int); static void setup_all_signals(void); static void setup_job_control_interrupts(void); +static void killcheck(pid_t, int); + +static void +killcheck(pid_t pid, int signo) +{ + if (kill(pid, signo) == 0) + return; + if (errno == ESRCH) { + fprintf(stderr, + "Can't send signal %d to %ld: pid not found\n", + signo, (long)pid); + } else if (errno == EPERM) { + fprintf(stderr, + "Can't send signal %d to %ld: not permitted\n", + signo, (long)pid); + } +} static void print_error(Job *j, Job *k) @@ -292,9 +309,6 @@ setup_all_signals(void) /* Have to see SIGCHLD */ setup_signal(SIGCHLD); got_fatal = 0; - setup_job_control_interrupts(); - setup_signal(SIGWINCH); - setup_signal(SIGCONT); got_other = 0; } @@ -785,7 +799,7 @@ pass_job_control_signal(int signo) debug_job_printf("pass_job_control_signal to " "child %ld running %s.\n", (long)job->pid, job->node->name); - killpg(job->pid, signo); + killcheck(job->pid, signo); } /* after forwarding the signal, those should interrupt us */ if (signo == SIGTSTP || signo == SIGTTOU || signo == SIGTTIN) { @@ -828,7 +842,7 @@ handle_fatal_signal(int signo) debug_job_printf("handle_fatal_signal: passing to " "child %ld running %s.\n", (long)job->pid, job->node->name); - killpg(job->pid, signo); + killcheck(job->pid, signo); } if (signo == SIGINT && !touchFlag) { |