1987-02-20 14:36:01 +00:00
|
|
|
static long masks[32];
|
|
|
|
static long flags[32];
|
1993-11-17 16:53:43 +00:00
|
|
|
void (*
|
1987-02-20 14:36:01 +00:00
|
|
|
signal(sig,handler))()
|
1993-11-17 16:53:43 +00:00
|
|
|
void (*handler)();
|
1987-02-20 14:36:01 +00:00
|
|
|
{
|
|
|
|
struct {
|
1993-11-17 16:53:43 +00:00
|
|
|
void (*sv_handler)();
|
1987-02-20 14:36:01 +00:00
|
|
|
long sv_mask;
|
|
|
|
long sv_flags;
|
|
|
|
} v, ov;
|
|
|
|
|
|
|
|
v.sv_handler = handler;
|
|
|
|
v.sv_mask = masks[sig];
|
|
|
|
v.sv_flags = flags[sig];
|
1993-11-17 16:53:43 +00:00
|
|
|
if (_sigvec(sig,&v, &ov) < 0) return (void (*)()) -1;
|
1987-02-20 14:36:01 +00:00
|
|
|
if (v.sv_mask != ov.sv_mask || v.sv_flags != ov.sv_flags) {
|
|
|
|
v.sv_mask = ov.sv_mask;
|
|
|
|
masks[sig] = ov.sv_mask;
|
|
|
|
v.sv_flags = ov.sv_flags;
|
|
|
|
flags[sig] = ov.sv_flags;
|
1993-11-17 16:53:43 +00:00
|
|
|
if (_sigvec(sig,&v,(char *) 0) < 0) return (void (*)()) -1;
|
1987-02-20 14:36:01 +00:00
|
|
|
}
|
|
|
|
return ov.sv_handler;
|
|
|
|
}
|