From owner-freebsd-hackers Tue Feb 16 14: 6:59 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from gatekeeper.tsc.tdk.com (gatekeeper.tsc.tdk.com [207.113.159.21]) by hub.freebsd.org (Postfix) with ESMTP id BB284110A3 for ; Tue, 16 Feb 1999 14:06:51 -0800 (PST) (envelope-from gdonl@tsc.tdk.com) Received: from sunrise.gv.tsc.tdk.com (root@sunrise.gv.tsc.tdk.com [192.168.241.191]) by gatekeeper.tsc.tdk.com (8.8.8/8.8.8) with ESMTP id OAA12195; Tue, 16 Feb 1999 14:06:16 -0800 (PST) (envelope-from gdonl@tsc.tdk.com) Received: from salsa.gv.tsc.tdk.com (salsa.gv.tsc.tdk.com [192.168.241.194]) by sunrise.gv.tsc.tdk.com (8.8.5/8.8.5) with ESMTP id OAA10408; Tue, 16 Feb 1999 14:06:15 -0800 (PST) Received: (from gdonl@localhost) by salsa.gv.tsc.tdk.com (8.8.5/8.8.5) id OAA14029; Tue, 16 Feb 1999 14:06:10 -0800 (PST) From: Don Lewis Message-Id: <199902162206.OAA14029@salsa.gv.tsc.tdk.com> Date: Tue, 16 Feb 1999 14:06:10 -0800 In-Reply-To: John Polstra "Re: select() can set errno to ECHILD?" (Feb 15, 4:17pm) X-Mailer: Mail User's Shell (7.2.6 alpha(3) 7/19/95) To: John Polstra , nsmart@kira.team400.ie Subject: Re: select() can set errno to ECHILD? Cc: hackers@FreeBSD.ORG Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Feb 15, 4:17pm, John Polstra wrote: } Subject: Re: select() can set errno to ECHILD? } In article <36C85A77.EDBC00F9@kira.team400.ie>, } Niall Smart wrote: } > Erik E Rantapaa wrote: } > > } > > I have code running under 2.2.x which claims that this is happening. } > > This behaviour is not documented in the man pages. I have not been able to } > > duplicate it in a simple test program I wrote, but the log files for } > > a Merit RADIUS server say that it is happening. } > > } > > Is this at all possible? } > } > You are getting SIGCHLD while blocked in select, waitpid with WNOHANG in } > then handler returns ECHILD, the signal handler fails to restore errno. } } But when the signal handler returns, it will return to select() } again, right? And select will either continue and eventually succeed } returning some number >= 0, or it will itself set errno (perhaps to } EINTR) and return -1, right? So if the caller of select checks its } return value and only looks at errno if the return value is -1, I } can't see how anything the signal handler does could confuse it. The signal handler could be invoked and stomp errno after select() returns and before the userland code looks at errno. This isn't real likely to happen, but you'll probably get bitten by this sooner or later. } In other words, if there is a bug in the application then it must be } that the application fails to check the return value of select before } examining errno. Code that fails to check the return value of a syscall before looking at errno will tend to fail pretty frequently. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message