From owner-freebsd-current Mon Mar 16 07:58:50 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA07572 for freebsd-current-outgoing; Mon, 16 Mar 1998 07:58:50 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from cons.org (knight.cons.org [194.233.237.86]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id HAA07562 for ; Mon, 16 Mar 1998 07:58:47 -0800 (PST) (envelope-from cracauer@cons.org) Received: (from cracauer@localhost) by cons.org (8.8.5/8.7.3) id RAA20971; Mon, 16 Mar 1998 17:00:33 +0100 (CET) Message-ID: <19980316170033.48124@cons.org> Date: Mon, 16 Mar 1998 17:00:33 +0100 From: Martin Cracauer To: Bruce Evans Cc: cracauer@cons.org, freebsd-current@FreeBSD.ORG Subject: Re: make/SIGINT (Re: cvs commit: src/bin/sh jobs.c) References: <199803151225.XAA06847@godzilla.zeta.org.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.81 In-Reply-To: <199803151225.XAA06847@godzilla.zeta.org.au>; from Bruce Evans on Sun, Mar 15, 1998 at 11:25:56PM +1100 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 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 #include #include + #include 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