Renamed files, updated header comments
[transsip-mirror.git] / src / signals.h
blob283ed4ad2570147cfc1fc35d087a321a0aed576d
1 /*
2 * transsip - the telephony network
3 * By Daniel Borkmann <daniel@transsip.org>
4 * Copyright 2011 Daniel Borkmann <dborkma@tik.ee.ethz.ch>,
5 * Swiss federal institute of technology (ETH Zurich)
6 * Subject to the GPL, version 2.
7 */
9 #ifndef SIGNALS_H
10 #define SIGNALS_H
12 #include <signal.h>
13 #include <assert.h>
15 static inline void register_signal(int signal, void (*handler)(int))
17 sigset_t block_mask;
18 struct sigaction saction;
20 assert(handler);
22 sigfillset(&block_mask);
23 saction.sa_handler = handler;
24 saction.sa_mask = block_mask;
25 saction.sa_flags = SA_RESTART;
27 sigaction(signal, &saction, NULL);
30 #endif /* SIGNALS_H */