Philip Guenther <[email protected]> writes:

> Instead of manually scanning the list of zombie processes, just use 
> zombiefind().
>
> The extra check in the current code for a zombie whose process group ID 
> matches the pid being checked can be safely removed because process groups 
> stay in the global hash (and thus found with pgfind()) until all the 
> processes in them are *reaped*, so the process group of a zombie process 
> is certain to still be found by pgfind().
>
> (Those curious to verify that can play with this perl snippet:
>
> perl -e '$pid = fork(); if(!$pid){setpgrp();sleep 4;exit} print "$pid\n"; 
> sleep 1; if (fork()){waitpid $pid, 0;sleep 3600; exit } setpgrp(0,$pid) or 
> die "$!"; sleep 5; print "becoming a zombie\n"; exit' &
>
> The pid that it prints will end up only being occupied by a zombie and you 
> can then verify that ktrace -g and kill both find it.)
>
> ok?

ok jca@

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to