From owner-freebsd-ports@FreeBSD.ORG Fri Oct 9 08:43:19 2009 Return-Path: Delivered-To: ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48E19106566B for ; Fri, 9 Oct 2009 08:43:19 +0000 (UTC) (envelope-from matthias.andree@gmx.de) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id A687E8FC13 for ; Fri, 9 Oct 2009 08:43:18 +0000 (UTC) Received: (qmail invoked by alias); 09 Oct 2009 08:43:16 -0000 Received: from balu.cs.uni-paderborn.de (EHLO balu.cs.uni-paderborn.de) [131.234.21.37] by mail.gmx.net (mp007) with SMTP; 09 Oct 2009 10:43:16 +0200 X-Authenticated: #428038 X-Provags-ID: V01U2FsdGVkX19JALZm065JdJv74N3Z56ULuRL5Wfui3df8TYLwX4 QfjOEnesFUqzRc Received: from localhost ([127.0.0.1] helo=balu.cs.uni-paderborn.de) by balu.cs.uni-paderborn.de with esmtp (Exim 4.69) (envelope-from ) id KR8O84-0008BC-GJ; Fri, 09 Oct 2009 10:43:16 +0200 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "Stephen Hocking" References: <6300771b0910071753s6580c099i8c348824a6fe1a72@mail.gmail.com> <4ACDCF28.6040807@gmx.de> <6300771b0910081838y6925627cubdbc4d4dbbc376b8@mail.gmail.com> Date: Fri, 09 Oct 2009 10:43:16 +0200 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Matthias Andree" Organization: Message-ID: In-Reply-To: <6300771b0910081838y6925627cubdbc4d4dbbc376b8@mail.gmail.com> User-Agent: Opera Mail/10.00 (Win32) X-Y-GMX-Trusted: 0 X-FuHaFi: 0.62 Cc: ports@freebsd.org Subject: Re: sigwait - differences between Linux & FreeBSD X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Oct 2009 08:43:19 -0000 Am 09.10.2009, 03:38 Uhr, schrieb Stephen Hocking : > It appears as if the documentation does not match up with the reality > in Linux's case. That's what the empirical evidence suggests anyway. > The code does does a waitpid after receiving the SIGCHLD to determine > what child process has exited and then searches its list of sessions > looking for that particular pid, so as to tidy up. My reception is: if the process wants SIGCHLD, it will have to install its own handler, because the default disposition for this signal is SIG_IGN (= discard signal and do not turn child process into a zombie). So use your patch for FreeBSD, feed it to the upstream maintainer with a copy of this thread and relevant quotes from the standard and manpage and move on. :) The alternative is to do away with SIGCHLD and use waitpid((pid_t)-1, WNOHANG) to poll for children that have exited. > I can to some degree understand that implementation of sigwait, as if > you state your intention to wait for a particular signal, that means > that you don't wish to ignore it. That's outside the standard. If it works on a particular Linux kernel version that doesn't mean it will work on every other. Why lose yourself in empirical programming if there are standards? -- Matthias Andree