Date: Sat, 23 Aug 1997 01:19:45 -0600 (MDT) From: Marc Slemko <marcs@znep.com> To: Sean Eric Fagan <sef@Kithrup.COM> Cc: julian@FreeBSD.ORG, current@FreeBSD.ORG Subject: Re: I've broken ping Message-ID: <Pine.BSF.3.95.970823010850.6677D-100000@alive.znep.com> In-Reply-To: <199707120707.AAA23391@kithrup.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 12 Jul 1997, Sean Eric Fagan wrote: > >(or if sean can post the patch someone else can check it in) > >(to 2.2 and 3.0) (don;t you have commit privs sean?) > > Yeah, I have patches, but I was hoping you'd be able to test it more > extensively than I could :). > > I can check it in tomorrow, otherwise. > > For the curious, the patches are below. I'm going to bed now :). Running under 2.2-stable from a week or two ago, both the 2.2 and -current ping are still broken. I am seeing it hang in pr_addr if the reverse isn't resolvable; ^C wont kill it because it appears like a function call is being restarted. I am confused about why this is happening. ISTR some changes in FreeBSD WRT this that I haven't had time to follow. Changing the sigaction() back to a signal() fixes this particular case. The signal() man page says function calls will be restarted, but the sigaction() man page implies they won't without SA_RESTART. That follows with what I am aware that recent BSD code does. It doesn't seem to fit with what I am seeing. > > Index: ping.c > =================================================================== > RCS file: /home/ncvs/src/sbin/ping/ping.c,v > retrieving revision 1.23 > diff -u -r1.23 ping.c > --- ping.c 1997/07/09 20:33:58 1.23 > +++ ping.c 1997/07/12 03:55:41 > @@ -423,8 +423,19 @@ > else > (void)printf("PING %s: %d data bytes\n", hostname, datalen); > > - (void)signal(SIGINT, stopit); > - (void)signal(SIGALRM, catcher); > + si_sa.sa_handler = stopit; > + sigemptyset(&si_sa.sa_mask); > + si_sa.sa_flags = 0; > + if (sigaction(SIGINT, &si_sa, 0) == -1) { > + err(EX_OSERR, "sigaction SIGINT"); > + } > + > + si_sa.sa_handler = catcher; > + sigemptyset(&si_sa.sa_mask); > + si_sa.sa_flags = 0; > + if (sigaction(SIGALRM, &si_sa, 0) == -1) { > + err(EX_OSERR, "sigaction SIGALRM"); > + } > > /* > * Use sigaction instead of signal() to get unambiguous semantics > @@ -508,9 +519,17 @@ > catcher(int sig) > { > int waittime; > + struct sigaction si_sa; > > pinger(); > - (void)signal(SIGALRM, catcher); > + > + si_sa.sa_handler = catcher; > + sigemptyset(&si_sa.sa_mask); > + si_sa.sa_flags = 0; > + if (sigaction(SIGALRM, &si_sa, 0) == -1) { > + err(EX_OSERR, "sigaction"); > + } > + > if (!npackets || ntransmitted < npackets) > alarm((u_int)interval); > else { > @@ -520,7 +539,9 @@ > waittime = 1; > } else > waittime = MAXWAIT; > - (void)signal(SIGALRM, stopit); > + finish_up = 1; > + si_sa.sa_handler = stopit; > + (void)sigaction(SIGALRM, &si_sa, 0); > (void)alarm((u_int)waittime); > } > } >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95.970823010850.6677D-100000>