1 /* SYSVR4 and ANSI compatible signal(2). */
4 #define sigaction _sigaction
5 #define sigemptyset _sigemptyset
8 PUBLIC sighandler_t
signal(sig
, disp
)
9 int sig
; /* signal number */
10 sighandler_t disp
; /* signal handler, or SIG_DFL, or SIG_IGN */
12 struct sigaction sa
, osa
;
14 if (sig
<= 0 || sig
> _NSIG
|| sig
== SIGKILL
) {
18 sigemptyset(&sa
.sa_mask
);
20 #ifdef WANT_UNRELIABLE_SIGNALS
21 /* Allow the signal being handled to interrupt the signal handler. */
22 sa
.sa_flags
= SA_NODEFER
;
24 /* When signal is caught, reset signal handler to SIG_DFL for all but
27 if (sig
!= SIGILL
&& sig
!= SIGTRAP
) sa
.sa_flags
|= SA_RESETHAND
;
33 if (sigaction(sig
, &sa
, &osa
) < 0) return(SIG_ERR
);
34 return(osa
.sa_handler
);