#include#include #include #include void alarm1(int sig){ printf("ALARM ....sig...%d\n", sig); (void)signal(SIGALRM, SIG_DFL);}void user1(int sig){ printf("user1 ....sig...%d\n", sig); (void)signal(SIGUSR1, SIG_DFL);}int main(int argc, char **argv){ pid_t pid; pid = fork(); switch(pid) { case -1: /* Failure */ perror("fork failed"); exit(1); case 0: /* child */ sleep(5); kill(getppid(), SIGUSR1); sleep(10); kill(getppid(), SIGALRM); printf("done..children\n"); exit(0); } //in parent (void)signal(SIGUSR1, user1); (void)signal(SIGALRM, alarm1); pause(); pause(); printf("done..father\n"); exit(0);}