fehQlibs 26
Qlibs
Loading...
Searching...
No Matches
sig.c
Go to the documentation of this file.
1#include <signal.h>
2#include "sig.h"
3
12{
13 sig_block(SIGALRM);
14}
16{
17 sig_unblock(SIGALRM);
18}
19void sig_alarmcatch(void (*f)(int))
20{
21 sig_catch(SIGALRM,f);
22}
24{
25 sig_catch(SIGALRM,SIG_DFL);
26}
27
28int sig_alarm = SIGALRM;
29
30void sig_block(int sig)
31{
32 sigset_t ss;
33 sigemptyset(&ss);
34 sigaddset(&ss,sig);
35 sigprocmask(SIG_BLOCK,&ss,(sigset_t *)0);
36}
37
38void sig_unblock(int sig)
39{
40 sigset_t ss;
41 sigemptyset(&ss);
42 sigaddset(&ss,sig);
43 sigprocmask(SIG_UNBLOCK,&ss,(sigset_t *)0);
44}
45
47{
48 sigset_t ss;
49 sigemptyset(&ss);
50 sigprocmask(SIG_SETMASK,&ss,(sigset_t *)0);
51}
52
53void sig_catch(int sig,void (*f)(int))
54{
55 struct sigaction sa;
56 sa.sa_handler = f;
57 sa.sa_flags = 0;
58 sigemptyset(&sa.sa_mask);
59 sigaction(sig,&sa,(struct sigaction *)0);
60}
61
62void sig_pause()
63{
64 sigset_t ss;
65 sigemptyset(&ss);
66 sigsuspend(&ss);
67}
68
70{
71 sig_catch(SIGPIPE,SIG_IGN);
72}
74{
75 sig_catch(SIGPIPE,SIG_DFL);
76}
77
78int sig_pipe = SIGPIPE;
79
81{
82 sig_block(SIGCHLD);
83}
85{
86 sig_unblock(SIGCHLD);
87}
88void sig_childcatch(void (*f)(int))
89{
90 sig_catch(SIGCHLD,f);
91}
93{
94 sig_catch(SIGCHLD,SIG_DFL);
95}
96
97int sig_child = SIGCHLD;
98
100{
101 sig_block(SIGHUP);
102}
104{
105 sig_unblock(SIGHUP);
106}
107void sig_hangupcatch(void (*f)(int))
108{
109 sig_catch(SIGHUP,f);
110}
112{
113 sig_catch(SIGHUP,SIG_DFL);
114}
115
116int sig_hangup = SIGHUP;
117
119{
120 sig_block(SIGTERM);
121}
123{
124 sig_unblock(SIGTERM);
125}
126void sig_termcatch( void (*f)(int))
127{
128 sig_catch(SIGTERM,f);
129}
131{
132 sig_catch(SIGTERM,SIG_DFL);
133}
134
135int sig_term = SIGTERM;
136
137void sig_bugcatch(void (*f)(int))
138{
139 sig_catch(SIGILL,f);
140 sig_catch(SIGABRT,f);
141 sig_catch(SIGFPE,f);
142 sig_catch(SIGBUS,f);
143 sig_catch(SIGSEGV,f);
144#ifdef SIGSYS
145 sig_catch(SIGSYS,f);
146#endif
147#ifdef SIGEMT
148 sig_catch(SIGEMT,f);
149#endif
150}
151void (*sig_defaulthandler)(int) = SIG_DFL;
152
154{
155 sig_catch(SIGVTALRM,SIG_IGN);
156 sig_catch(SIGPROF,SIG_IGN);
157 sig_catch(SIGQUIT,SIG_IGN);
158 sig_catch(SIGINT,SIG_IGN);
159 sig_catch(SIGHUP,SIG_IGN);
160#ifdef SIGXCPU
161 sig_catch(SIGXCPU,SIG_IGN);
162#endif
163#ifdef SIGXFSZ
164 sig_catch(SIGXFSZ,SIG_IGN);
165#endif
166}
167void (*sig_ignorehandler)() = SIG_IGN;
168
169int sig_cont = SIGCONT;
void sig_pipedefault()
Definition: sig.c:73
int sig_child
Definition: sig.c:97
int sig_alarm
Definition: sig.c:28
int sig_hangup
Definition: sig.c:116
void sig_termcatch(void(*f)(int))
Definition: sig.c:126
void sig_bugcatch(void(*f)(int))
Definition: sig.c:137
void sig_hangupunblock()
Definition: sig.c:103
int sig_cont
Definition: sig.c:169
void sig_alarmblock()
Definition: sig.c:11
void sig_miscignore()
Definition: sig.c:153
void sig_block(int sig)
Definition: sig.c:30
void sig_termblock()
Definition: sig.c:118
void sig_catch(int sig, void(*f)(int))
Definition: sig.c:53
int sig_term
Definition: sig.c:135
void sig_hangupcatch(void(*f)(int))
Definition: sig.c:107
void sig_childdefault()
Definition: sig.c:92
void sig_childblock()
Definition: sig.c:80
void sig_unblock(int sig)
Definition: sig.c:38
void sig_childcatch(void(*f)(int))
Definition: sig.c:88
void sig_termunblock()
Definition: sig.c:122
void sig_childunblock()
Definition: sig.c:84
void sig_alarmdefault()
Definition: sig.c:23
void sig_hangupblock()
Definition: sig.c:99
int sig_pipe
Definition: sig.c:78
void sig_termdefault()
Definition: sig.c:130
void sig_blocknone()
Definition: sig.c:46
void sig_alarmunblock()
Definition: sig.c:15
void sig_pipeignore()
Definition: sig.c:69
void(* sig_ignorehandler)()
Definition: sig.c:167
void sig_hangupdefault()
Definition: sig.c:111
void sig_pause()
Definition: sig.c:62
void(* sig_defaulthandler)(int)
Definition: sig.c:151
void sig_alarmcatch(void(*f)(int))
Definition: sig.c:19