From owner-freebsd-current Fri Dec 11 11:58:22 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA19581 for freebsd-current-outgoing; Fri, 11 Dec 1998 11:58:22 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from whistle.com (s205m131.whistle.com [207.76.205.131]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA19568 for ; Fri, 11 Dec 1998 11:58:21 -0800 (PST) (envelope-from archie@whistle.com) Received: (from smap@localhost) by whistle.com (8.7.5/8.6.12) id LAA19435 for ; Fri, 11 Dec 1998 11:58:10 -0800 (PST) Received: from bubba.whistle.com( 207.76.205.7) by whistle.com via smap (V2.0) id xma019428; Fri, 11 Dec 98 11:57:59 -0800 Received: (from archie@localhost) by bubba.whistle.com (8.8.7/8.6.12) id LAA27876 for freebsd-current@FreeBSD.ORG; Fri, 11 Dec 1998 11:57:59 -0800 (PST) From: Archie Cobbs Message-Id: <199812111957.LAA27876@bubba.whistle.com> Subject: Re: inetd: realloc/free bug In-Reply-To: <199812111940.LAA27652@bubba.whistle.com> from Archie Cobbs at "Dec 11, 98 11:40:58 am" To: freebsd-current@FreeBSD.ORG Date: Fri, 11 Dec 1998 11:57:59 -0800 (PST) X-Mailer: ELM [version 2.4ME+ PL38 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Archie Cobbs writes: > > What horror results from doing this in a signal handler? On e-paper, it > > seems to give the desired effect, but does a return from a signal > > handler implicitly call sigreturn(2) when it returns? And if so, is > > there anything that requires this to happen? > > I guess I was thinking in terms of the event library model; that is, > you don't handle the signal event in the signal handler (because in > general the event handler could call malloc(), etc), but rather you > simply set a flag (call it "signalFlag"). > > The race condition is getting a signal between the first and second > lines below: > > sigprocmask(SIG_UNBLOCK ..) /* unblock signals */ > r = select(...) /* wait for event */ > sigprocmask(SIG_BLOCK ..) /* block signals */ > > if (signalFlag || r > 0) { > ... /* handle event(s) */ > } OK, if you call the signal "event" handler from within the actual signal handler because of a signal received bewtween lines 1 and 2, that's OK because you know you're not in a recursive malloc() situation. So I guess that would work. -Archie ___________________________________________________________________________ Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message