Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Thu, 16 Sep 2004 13:27:28 -0400 From: Chet Ramey To: cgf AT cygwin DOT com Subject: Re: Bash returns incorrect process status Cc: chet AT po DOT cwru DOT edu, pierre DOT humblet AT ieee DOT org, cygwin AT cygwin DOT com, ronald AT landheer DOT com Reply-To: chet AT po DOT cwru DOT edu References: <41499B4A DOT 207AC15F AT ieee DOT org> <040916151300 DOT AA27319 DOT SM AT caleb DOT ins DOT cwru DOT edu> <20040916154409 DOT GC681 AT trixie DOT casa DOT cgf DOT cx> In-Reply-To: Message from cgf@cygwin.com of Thu, 16 Sep 2004 11:44:09 -0400 (id <20040916154409.GC681@trixie.casa.cgf.cx>) Message-ID: <040916172728.AA27372.SM@caleb.ins.cwru.edu> Read-Receipt-To: chet AT po DOT CWRU DOT Edu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii > Is there some reason why we aren't discussing this on the mailing > list? Which mailing list? I'm not on the cygwin list. > >POSIX shells are required to remember at least CHILD_MAX (but > >optionally more) process statuses. There is a gray area about whether > >or not the user can query the status of those processes, implying that > >once the status of a background or foreground job has been reported, > >its status, and the status of its constituent processes, can be > >discarded, but those rules are hard to decipher. > > Are you saying that waitpid should be able to return the status of an > exited process when it is called repeatedly? I've never seen anything > like that. I thought that once you'd done a wait the process was > unzombified, it goes away, and it is unavailable for future querying. No. The portion of the POSIX spec describing the shell's behavior is independent of the exact function used to query a process's status. It says the shell has to remember. It doesn't mention waitpid(), nor does it need to. You're assuming that the shell just does a waitpid() whenever it needs to get a particular process's status. No shell does it that way. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ( ``Discere est Dolere'' -- chet ) Live...Laugh...Love Chet Ramey, ITS, CWRU chet AT po DOT cwru DOT edu http://tiswww.tis.cwru.edu/~chet/ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/