Subject: Re: Bash returns incorrect process status
From: Chet Ramey <[email-masked]>
To: [email-masked]
Cc: [email-masked], [email-masked], [email-masked], [email-masked]
Date: Thu, 16 Sep 2004 13:27:28 -0400

> 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    [email-masked]    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/