summaryrefslogtreecommitdiff
path: root/other/b-scan/tmp/src/signal.c
blob: a2af01ff9bfd236612bfa94c6f7432126bb2b999 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include <signal.h>
#include <bscan/signal.h>

/*
 * add the signals that you want to be set to default-action
 */
int
do_sig_setall (sighandler_t action)
{
#ifdef SIGHUP
    signal (SIGHUP, action);
#endif
#ifdef SIGINT
    signal (SIGINT, action);
#endif
#ifdef SIGQUIT
    signal (SIGQUIT, action);
#endif
#ifdef SIGABRT
    signal (SIGABRT, action);
#endif
#ifdef SIGPIPE
    signal (SIGPIPE, action);
#endif
#ifdef SIGALRM
    signal (SIGALRM, action);
#endif
#ifdef SIGTERM
    signal (SIGTERM, action);
#endif
#ifdef SIGUSR1
    signal (SIGUSR1, action);
#endif
#ifdef SIGUSR1
    signal (SIGUSR1, action);
#endif
#ifdef SIGCHLD
    signal (SIGCHLD, action);
#endif
#ifdef SIGCOMT
    signal (SIGCOMT, action);
#endif
#ifdef SIGSTOP
    signal (SIGSTOP, action);
#endif
#ifdef SIGTSTP
    signal (SIGTSTP, action);
#endif
#ifdef SIGTTIM
    signal (SIGTTIM, action);
#endif
#ifdef SIGTTOU
    signal (SIGTTOU, action);
#endif

    return (0);
}

/*
 * sig-ctl function.
 * atm only SIG_DFL implemented....
 */
int
sigctl (int flags, sighandler_t action)
{
    int ret = 0;

    if (flags & SIG_SETALL)
	ret = do_sig_setall (action);

    return (ret);
}