/**************************************/
/*                                    */
/*  Prof. Dr. Carsten Vogt            */
/*  Fachhochschule Koeln              */
/*  Fakultaet 07, Nachrichtentechnik  */
/*  http://www.nt.fh-koeln.de/vogt    */
/*                                    */
/*  UNIX-C-Schnittstelle:             */
/*  kill()                            */
/*                                    */
/**************************************/

#include <stdio.h>
#include <stdlib.h>
#include <signal.h>

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); 

}
