Date: Mon, 16 Mar 1998 17:00:33 +0100 From: Martin Cracauer <cracauer@cons.org> To: Bruce Evans <bde@zeta.org.au> Cc: cracauer@cons.org, freebsd-current@FreeBSD.ORG Subject: Re: make/SIGINT (Re: cvs commit: src/bin/sh jobs.c) Message-ID: <19980316170033.48124@cons.org> In-Reply-To: <199803151225.XAA06847@godzilla.zeta.org.au>; from Bruce Evans on Sun, Mar 15, 1998 at 11:25:56PM %2B1100 References: <199803151225.XAA06847@godzilla.zeta.org.au>
next in thread | previous in thread | raw e-mail | index | archive | help
In <199803151225.XAA06847@godzilla.zeta.org.au>, Bruce Evans wrote: > >What about the appended fix for make? It seems to fix the problem for > >the non-compat mode of make. As our make is in compat mode by default > >even if -B is not given, people would have to use `make -j 1` for now > >to test it. > > I found another problem: time(1) has much the same problem as make(1) [...] > #!/bin/sh > time make foo > echo $? > time make bar > echo $? > > Now `time' exits normally with status 1, so our modified sh continues. I finally get used to this kind of stuff :-), proposed patch appended. Martin -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Martin Cracauer <cracauer@cons.org> http://www.cons.org/cracauer cracauer@wavehh.hanse.de (batched, preferred for large mails) Tel.: (daytime) +4940 41478712 Fax.: (daytime) +4940 41478715 Tel.: (private) +4940 5221829 Fax.: (private) +4940 5228536 Paper: (private) Waldstrasse 200, 22846 Norderstedt, Germany *** time.original/time.c Tue Aug 26 12:08:45 1997 --- time.work/time.c Mon Mar 16 16:51:30 1998 *************** *** 56,61 **** --- 56,62 ---- #include <err.h> #include <stdio.h> #include <unistd.h> + #include <signal.h> static int getstathz __P((void)); static void usage __P((void)); *************** *** 69,74 **** --- 70,76 ---- int ch, status, lflag; struct timeval before, after; struct rusage ru; + int exitonsig = 0; /* Die with same signal as child */ lflag = 0; while ((ch = getopt(argc, argv, "l")) != -1) *************** *** 101,108 **** (void)signal(SIGQUIT, SIG_IGN); while (wait3(&status, 0, &ru) != pid); /* XXX use waitpid */ gettimeofday(&after, (struct timezone *)NULL); ! if (status&0377) warnx("command terminated abnormally"); after.tv_sec -= before.tv_sec; after.tv_usec -= before.tv_usec; if (after.tv_usec < 0) --- 103,112 ---- (void)signal(SIGQUIT, SIG_IGN); while (wait3(&status, 0, &ru) != pid); /* XXX use waitpid */ gettimeofday(&after, (struct timezone *)NULL); ! if ( ! WIFEXITED(status)) warnx("command terminated abnormally"); + if (WIFSIGNALED(status)) + exitonsig = WTERMSIG(status); after.tv_sec -= before.tv_sec; after.tv_usec -= before.tv_usec; if (after.tv_usec < 0) *************** *** 154,159 **** --- 158,169 ---- ru.ru_nvcsw, "voluntary context switches"); fprintf(stderr, "%10ld %s\n", ru.ru_nivcsw, "involuntary context switches"); + } + if (exitonsig) { + if (signal(exitonsig, SIG_DFL) < 0) + perror("signal"); + else + kill(getpid(), exitonsig); } exit (WIFEXITED(status) ? WEXITSTATUS(status) : EXIT_FAILURE); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980316170033.48124>