trafgen: icmpv4: Update csum at runtime if needed
[netsniff-ng-new.git] / sig.c
blob2b5ab5ecadd20d76e0913ebbe7539f85eedbee03
1 #include <stdio.h>
2 #include <signal.h>
4 #include "sig.h"
6 void register_signal(int signal, void (*handler)(int))
8 sigset_t block_mask;
9 struct sigaction saction;
11 sigfillset(&block_mask);
13 saction.sa_handler = handler;
14 saction.sa_mask = block_mask;
15 saction.sa_flags = SA_RESTART;
17 sigaction(signal, &saction, NULL);
20 void register_signal_f(int signal, void (*handler)(int), int flags)
22 sigset_t block_mask;
23 struct sigaction saction;
25 sigfillset(&block_mask);
27 saction.sa_handler = handler;
28 saction.sa_mask = block_mask;
29 saction.sa_flags = flags;
31 sigaction(signal, &saction, NULL);