/******************************************************/ /* DUT INFORMATIQUE - M311 - R. CHIGNOLI */ /* demo_kill_grp_1.c : Utilisation de la routine kill */ /******************************************************/ # include # include #include #include int main () { int res; res = fork (); if (res != 0) { printf ("\nPERE No %d ( GRPID = %d ) : j'attends 5 secondes...\n", getpid(), getpgrp()); sleep (5); printf ("\nPERE No %d ( GRPID = %d ) : ... puis je me suicide par kill\n\n", getpid(), getpgrp()); kill (0, SIGKILL); printf ("\nPERE No %d ( GRPID = %d ) : ... je suis mort\n\n", getpid(), getpgrp()); } else { printf ("\nFILS No %d ( GRPID = %d ) : Je boucle indefiniment ...\n", getpid(), getpgrp()); for(;;); } }