How can a parent find out if one of its children is still alive

Tom Armistead toma at ozdaltx.UUCP
Sat Jun 2 15:14:48 AEST 1990


In article <30408 at cup.portal.com>, DeadHead at cup.portal.com (Bruce M Ong) writes:
> I am sure there is a very easy way to do this, but I just havent
> figured this one out:
> 	
> 	How can a parent find out if one of its children is still alive
> or not without

.....

If you have the process id of the child you can use kill(2) to find out if
it is still there.

i.e.:   if( kill( child_pid, 0 ) == -1 )
            puts( "The child is dead" );

Signal 0 is called the NULL signal and is used to validate a process id, no 
signal is actually sent to the destination process.

Will this do it for you?

Tom
-- 
-------------------------------
{uunet,smu}!sulaco!ozdaltx!toma         (Tom Armistead @ Garland, Texas)
{uunet,smu}!sulaco!ozdaltx!swsrv1!toma 



More information about the Comp.unix.wizards mailing list