From owner-freebsd-current Sun Dec 13 22:54:15 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id WAA06250 for freebsd-current-outgoing; Sun, 13 Dec 1998 22:28:21 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from mailb.telia.com (mailb.telia.com [194.22.194.6]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id WAA05782 for ; Sun, 13 Dec 1998 22:27:00 -0800 (PST) (envelope-from listuser@netspace.net.au) Received: from d1o1.telia.com (root@d1o1.telia.com [195.67.240.241]) by mailb.telia.com (8.8.8/8.8.8) with ESMTP id HAA08522 for ; Mon, 14 Dec 1998 07:26:51 +0100 (CET) Received: from doorway.home.lan (t6o1p59.telia.com [195.67.241.119]) by d1o1.telia.com (8.8.8/8.8.5) with ESMTP id HAA19219 for ; Mon, 14 Dec 1998 07:26:49 +0100 (CET) Received: (from listuser@localhost) by doorway.home.lan (8.8.8/8.8.7) id GAA06687 for freebsd-current@FreeBSD.org; Mon, 14 Dec 1998 06:53:53 +0100 (CET) (envelope-from listuser) Date: Mon, 14 Dec 1998 06:53:53 +0100 (CET) From: List User Message-Id: <199812140553.GAA06687@doorway.home.lan> To: freebsd-current@FreeBSD.org Sender: owner-freebsd-current@FreeBSD.org Precedence: bulk X-Loop: FreeBSD.ORG Newsgroups: freebsd.current Path: root From: Terry Lambert Subject: Re: inetd: realloc/free bug Content-Type: text/plain; charset=US-ASCII Received: (from tlambert@localhost) by usr09.primenet.com (8.8.5/8.8.5) id PAA10799; Sun, 13 Dec 1998 15:53:54 -0700 (MST) To: archie (Archie Cobbs) Sender: owner-freebsd-current@FreeBSD.ORG Content-Transfer-Encoding: 7bit Organization: Private News Host Precedence: bulk Message-ID: <199812132253.PAA10799@usr09.primenet.com> X-Mailer: ELM [version 2.4 PL25] Delivered-To: vmailer-current@freebsd.org X-Uidl: c91810ec79230b03092ce6e89e303611 X-Loop: FreeBSD.ORG Mime-Version: 1.0 In-Reply-To: <199812111940.LAA27652@bubba.whistle.com> from "Archie Cobbs" at Dec 11, 98 11:40:58 am Cc: peter.edwards, dillon, jwd, freebsd-current Date: Sun, 13 Dec 1998 22:53:54 GMT > 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) */ > } > > But there are probably smarter ways to do it than this. Yes. Don't block signals, use a setjmp for the select, and choose system call restart behaviour. The race you are concerned with is a signal occurring before the select starts, and the resulting EINTR. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message