4 * Objective: The purpose of this check the behaviour when a signal is received
5 * and there is a handler.
7 * Description: The program handles SIGHUP and expects the user to actually send
8 * the signal from other terminal with 'kill -1 pid'
13 #include <sys/types.h>
14 #include <sys/select.h>
23 void catch_hup(int sig_num
)
25 /* don't need to reset signal handler */
26 printf("Received a SIGHUP, inside the handler now\n");
30 int ret
; /* return value */
32 /* set the HUP sginal handler to 'catch_hup' */
33 signal(SIGHUP
, catch_hup
);
34 /* Get proc_id and print it */
35 printf("Send a signal from other terminal with: kill -1 %d\n", getpid());
36 printf("Blocking now on select...\n", SECONDS
);
37 ret
= select(0, NULL
, NULL
, NULL
, NULL
);
38 printf("Errno: %d\n", errno
);