/******************************************/ /* */ /* testkillloop.c */ /* Author: Iasonas Petras */ /* */ /******************************************/ #define _POSIX_SOURCE 1 /* For the kill function */ #include #include #include #include #include /* Demonstrates the kill C function. The function returns 0 on success.*/ int main() { pid_t ipid; ipid = getpid(); printf("Entering an infinite loop\n"); fflush(stdout); if(kill(ipid, SIGKILL) == -1) { perror(NULL); exit(EXIT_FAILURE); } for (;;) ; return 0; } /******************** Sample execution **********************/ /* $ ./testkillloop Entering an infinite loop Killed */