#include #include #include #include int main(int argc, char **argv) { pid_t pid; if ( ( pid = fork() ) < 0 ) { perror( "fork" ); exit( 1 ); } if ( pid == 0 ) { sleep( 60 ); exit( 0 ); } if ( kill( pid, SIGKILL ) < 0 ) { perror( "kill" ); exit( 1 ); } else { int status; while ( waitpid( pid, &status, 0 ) < 0 ) { if ( errno != EINTR ) { perror( "waitpid" ); exit( 1 ); } } printf( "Child %d exited with status %d\n", pid, status ); } exit( 0 ); }