exec()'s behavior when ppid == 1

Christopher Faylor cgf@redhat.com
Tue Jun 3 02:33:00 GMT 2003

On Mon, Jun 02, 2003 at 09:42:53PM -0400, Pierre A. Humblet wrote:
>At 09:10 PM 6/2/2003 -0400, Christopher Faylor wrote:
>>On Mon, Jun 02, 2003 at 08:21:33PM -0400, Pierre A. Humblet wrote:
>>>When Windows spawns a Cygwin process A, A has ppid 1 and ppid_handle 0.
>>>If process A execs B, Cygwin keeps A alive. If B then execs C, B stays 
>>>alive too. When C terminates, B and A follow suit and Windows goes on its
>>>So far so good.
>>>Now suppose that A forks X and A terminates. Windows goes on its way
>>>right away.
>>>Meanwhile X (which now has ppid 1 but a non zero ppid_handle) execs B
>>>and X is kept alive. If B execs C, B is also kept alive. When C 
>>>terminates, B and X follow suit.
>>>Q: Why does it help to keep X and B alive until C terminates?
>>I'd prefer this patch, if it still works as desired.
>>It seems to in my limited testing.
>Right, that's cleaner. It seems to work fine here also.

Ok.  I'll check that in.  Someday I have to fix that process A, B, C
all stay around problem, too.  I've had an idea about how to do that
for years.

Thanks for noticing this, btw.  I suspect that this hanging behavior
has probably caused some head scratching on the cygwin mailing list
for a while.


More information about the Cygwin-developers mailing list