/**************************************/ /* */ /* Prof. Dr. Carsten Vogt */ /* TH Koeln, Fakultaet IME */ /* http://www.nt.th-koeln.de/vogt */ /* */ /* UNIX-C-Schnittstelle: */ /* kill() */ /* */ /**************************************/ #include #include #include #include int main() { int sohn_pid, i=0; if ((sohn_pid=fork())==0) { /* Endlosschleife des Sohns mit Ausgabe einer Zahlenfolge. */ while (1) printf("Sohn: %d\n",i++); } /* Vater wartet 2 Sekunden */ sleep(2); /* Vater beendet den Sohn, indem er ihm das Signal SIGKILL schickt. */ kill(sohn_pid,SIGKILL); }