Date: Mon, 4 Mar 2002 11:40:02 -0800 (PST) From: Sandeep Kumar <skumar@juniper.net> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/35214: dump program hangs while exiting Message-ID: <200203041940.g24Je2Q67732@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/35214; it has been noted by GNATS. From: Sandeep Kumar <skumar@juniper.net> 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 <errno.h> #include <fcntl.h> -#include <setjmp.h> #include <signal.h> #include <stdio.h> #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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203041940.g24Je2Q67732>