source: trunk/minix/test/select/test12.c@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 954 bytes
Line 
1/*
2 * Test name: test12.c
3 *
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'
9
10 * Jose M. Gomez
11 */
12
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>
20
21#define SECONDS 15
22
23void catch_hup(int sig_num)
24{
25 /* don't need to reset signal handler */
26 printf("Received a SIGHUP, inside the handler now\n");
27}
28
29int main(void) {
30 int ret; /* return value */
31
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);
39}
Note: See TracBrowser for help on using the repository browser.