From owner-freebsd-bugs Mon Mar 4 11:40: 7 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 92C7837B402 for ; Mon, 4 Mar 2002 11:40:02 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g24Je2Q67732; Mon, 4 Mar 2002 11:40:02 -0800 (PST) (envelope-from gnats) Date: Mon, 4 Mar 2002 11:40:02 -0800 (PST) Message-Id: <200203041940.g24Je2Q67732@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Sandeep Kumar Subject: Re: bin/35214: dump program hangs while exiting Reply-To: Sandeep Kumar Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/35214; it has been noted by GNATS. From: Sandeep Kumar To: freebsd-gnats-submit@FreeBSD.org, skumar@juniper.net Cc: Subject: Re: bin/35214: dump program hangs while exiting Date: Mon, 04 Mar 2002 11:32:41 -0800 Submitting unified diff for the fix. Index: tape.c =================================================================== RCS file: /cvs/junos-2001/src/sbin/dump/tape.c,v retrieving revision 1.1.1.4 retrieving revision 1.2 diff -u -r1.1.1.4 -r1.2 --- tape.c 2001/03/31 04:38:41 1.1.1.4 +++ tape.c 2002/03/01 17:53:24 1.2 @@ -57,7 +57,6 @@ #include #include -#include #include #include #ifdef __STDC__ @@ -121,10 +120,6 @@ int master; /* pid of master, for sending error signals */ int tenths; /* length of tape used per block written */ static int caught; /* have we caught the signal to proceed? */ -static int ready; /* have we reached the lock point without having */ - /* received the SIGUSR2 signal from the prev slave? */ -static jmp_buf jmpbuf; /* where to jump to if we are ready when the */ - /* SIGUSR2 arrives from the previous slave */ int alloctape() @@ -679,9 +674,6 @@ proceed(signo) int signo; { - - if (ready) - longjmp(jmpbuf, 1); caught++; } @@ -755,7 +747,13 @@ { register int nread; int nextslave, size, wrote, eot_count; + sigset_t sigusr2_mask, omask; + + /* Create a mask with SIGUSR2 */ + sigemptyset(&sigusr2_mask); + sigaddset(&sigusr2_mask, SIGUSR2); + /* * Need our own seek pointer. */ @@ -788,14 +786,12 @@ TP_BSIZE) != TP_BSIZE) quit("master/slave protocol botched.\n"); } - } - if (setjmp(jmpbuf) == 0) { - ready = 1; - if (!caught) - (void) pause(); } - ready = 0; + sigprocmask(SIG_BLOCK, &sigusr2_mask, &omask); /*Mask SIGUSR2*/; + if (!caught) + (void) sigsuspend(&omask); /* wait for SIGUSR2 */ caught = 0; + sigprocmask(SIG_SETMASK, &omask, NULL); /* Set the old mask */ /* Try to write the data... */ eot_count = 0; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message