ack/mach/sun2/libsys/signal.c

26 lines
566 B
C
Raw Permalink Normal View History

1987-03-03 09:37:26 +00:00
static long masks[32];
static long flags[32];
1993-11-17 16:53:43 +00:00
void (*
1987-03-03 09:37:26 +00:00
signal(sig,handler))()
1993-11-17 16:53:43 +00:00
void (*handler)();
1987-03-03 09:37:26 +00:00
{
struct {
1993-11-17 16:53:43 +00:00
void (*sv_handler)();
1987-03-03 09:37:26 +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-03-03 09:37:26 +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-03-03 09:37:26 +00:00
}
return ov.sv_handler;
}