: UNIX

7.2.3

7.2.3

kill. :

kill(pid, signum)

pid ( ), signum . pid :

pid , pid.

pid 0, , , kill.

pid -1, , , , kill ( . 7.6). , , , , 0 1.

pid , -1, , , pid.

, , , , , ( ) , , kill .

, 7.13, 10 . - , , , , . getpid getpgrp , , pause . kill , . , , .

#include signal.h
main() {
register int i;
setpgrp();
for (i = 0; i 10; i++){
if (fork()== 0) {
/* */
if (i& 1)setpgrp();
printf("pid = %d pgrp = %dn", getpid(), getpgrp());
pause(); /* */
}
}
kill(0, SIGINT);
}

7.13. setpgrp


: 0.142. /Cache: 5 / 0