How can a parent find out if one of its children is still alive
Steven Bellovin
smb at ulysses.att.com
Thu Jun 7 05:22:28 AEST 1990
In article <1046 at gargoyle.uchicago.edu>, matt at group-w.uchicago.edu (Matt Crawford) writes:
} ) DeadHead at cup.portal.com (Bruce M Ong) writes:
} ) > How can a parent find out if one of its children is still alive
} ) > or not without
}
} Tom Armistead, wizard-wannabe, answers:
} ) i.e.: if( kill( child_pid, 0 ) == -1 )
} ) puts( "The child is dead" );
}
} overlooking the possibility that the child exited many minutes ago and
} the pid is now being used by some unrelated process.
You can look at errno to determine if the kill() failed because of
a uid mismatch. That will yield a lot of info if root isn't doing
the checking.
More information about the Comp.unix.wizards
mailing list