This is the mail archive of the
mailing list for the Cygwin project.
Re: Bash returns incorrect process status
- From: Chet Ramey <chet at caleb dot ins dot cwru dot edu>
- To: cgf at cygwin dot com
- 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
- Date: Thu, 16 Sep 2004 13:27:28 -0400
- Subject: Re: Bash returns incorrect process status
- Read-receipt-to: chet@po.CWRU.Edu
- References: <41499B4A.207AC15F@ieee.org> <040916151300.AA27319.SM@caleb.ins.cwru.edu> <20040916154409.GC681@trixie.casa.cgf.cx>
- Reply-to: chet at po dot CWRU dot Edu
> Is there some reason why we aren't discussing this on the mailing
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.
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
Chet Ramey, ITS, CWRU email@example.com http://tiswww.tis.cwru.edu/~chet/
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html