Programming around zombies (Was Re: Zombies ???)
Jim Hutchison
hutch at sdcsvax.UCSD.EDU
Wed Dec 10 09:23:55 AEST 1986
<>
Setting SIGCHLD to SIGIGN will cause init to adopt your poor child and let
it exit in peace. This works under sys III (PC/IX), and berkeley 4.3, no
others verified. Here is a sample program (its real short).
#include <stdio.h>
#include <sys/signal.h>
main()
{
if (fork() == 0) { /* seperate noodles */
if ((long)signal(SIGCHLD,SIG_IGN) == -1L) { /* Ignored child */
fprintf(stderr,"Signal failed in child\n");
exit(-1);
}
puts("Child waiting");
sleep(5); /* for parent to exit */
puts("Bye bye");
exit(0);
}
puts("Parent Bails");
exit(0);
}
--
=
Jim Hutchison UUCP: {dcdwest,ucbvax}!sdcsvax!hutch
ARPA: Hutch at sdcsvax.ucsd.edu
panic -- no witty phrase
More information about the Comp.unix.wizards
mailing list