From owner-freebsd-hackers@FreeBSD.ORG Wed Feb 10 17:58:37 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD9DE1065679 for ; Wed, 10 Feb 2010 17:58:37 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id F31DB8FC0A for ; Wed, 10 Feb 2010 17:58:36 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id TAA07096; Wed, 10 Feb 2010 19:58:32 +0200 (EET) (envelope-from avg@icyb.net.ua) Message-ID: <4B72F3C7.7060004@icyb.net.ua> Date: Wed, 10 Feb 2010 19:58:31 +0200 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.23 (X11/20091206) MIME-Version: 1.0 To: Garrett Cooper , Naveen Gujje References: <39c945731002100925i2e466768peac89cdef15463f2@mail.gmail.com> <7d6fde3d1002100952g1518bc36r371020260e81a8c3@mail.gmail.com> In-Reply-To: <7d6fde3d1002100952g1518bc36r371020260e81a8c3@mail.gmail.com> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: System() returning ECHILD error on FreeBSD 7.2 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Feb 2010 17:58:37 -0000 on 10/02/2010 19:52 Garrett Cooper said the following: > Isn't this section of the system(3) libcall essentially doing what > you want, s.t. you'll never be able to get the process status when you > call waitpid(2)? > > do { > pid = _wait4(savedpid, &pstat, 0, (struct rusage *)0); > } while (pid == -1 && errno == EINTR); > break; > > You typically get status via wait*(2) when using exec*(2) or via > the return codes from system(3), not system(3) with wait*(2)... Exactly. I think that SIGCHLD handler would effectively 'reap' the child and thus wait*() in system would rightfully return ECHILD (perhaps after doing EINTR iteration of the loop). -- Andriy Gapon