4 * Use sigaction() to simulate BSD signal()
9 void (*bsd_signal(int signum
, void (*handler
) (int))) (int) {
10 struct sigaction action
, oldaction
;
12 memset(&action
, 0, sizeof action
);
13 action
.sa_handler
= handler
;
14 sigemptyset(&action
.sa_mask
);
15 sigaddset(&action
.sa_mask
, signum
);
16 action
.sa_flags
= SA_RESTART
;
18 if (sigaction(signum
, &action
, &oldaction
) == -1) {
26 return oldaction
.sa_handler
;