kernel: print spurious interrupt message with increasing interval.
[minix.git] / test / select / test12.c
blobf69d876dadac97a1756c432c35abf7d2062475a4
1 /*
2 * Test name: test12.c
4 * Objective: The purpose of this check the behaviour when a signal is received
5 * and there is a handler.
6 *
7 * Description: The program handles SIGHUP and expects the user to actually send
8 * the signal from other terminal with 'kill -1 pid'
10 * Jose M. Gomez
13 #include <sys/types.h>
14 #include <sys/select.h>
15 #include <unistd.h>
16 #include <time.h>
17 #include <stdio.h>
18 #include <signal.h>
19 #include <errno.h>
21 #define SECONDS 15
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");
29 int main(void) {
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);