int ucbsiginterrupt(int sig, int flag) { struct sigvec sv; int ret; if ((ret = ucbsigvec(sig, 0, &sv)) < 0) return (ret); if (flag) sv.sv_flags |= SV_INTERRUPT; else sv.sv_flags &= ~SV_INTERRUPT; return (ucbsigvec(sig, &sv, 0)); }
void (* ucbsignal(int s, void (*a)()))() { struct sigvec osv; struct sigvec nsv; static int mask[NSIG]; static int flags[NSIG]; nsv.sv_handler = a; nsv.sv_mask = mask[s]; nsv.sv_flags = flags[s]; if (ucbsigvec(s, &nsv, &osv) < 0) return (SIG_ERR); if (nsv.sv_mask != osv.sv_mask || nsv.sv_flags != osv.sv_flags) { mask[s] = nsv.sv_mask = osv.sv_mask; flags[s] = nsv.sv_flags = osv.sv_flags & ~(SV_RESETHAND|SV_INTERRUPT); if (ucbsigvec(s, &nsv, (struct sigvec *)0) < 0) return (SIG_ERR); } return (osv.sv_handler); }
int sigvec(int sig, struct sigvec *nvec, struct sigvec *ovec) { int newsig; struct sigvec tvec, *tvecp; void (*oldhand)(int); if ((int)nvec == -1 || (int)ovec == -1) { errno = EFAULT; return (-1); } newsig = maptonewsig(sig); oldhand = handlers[newsig]; if ((tvecp = nvec) != 0) { tvec = *nvec; tvecp = &tvec; /* * To be compatible with the behavior of SunOS 4.x: * If the new signal handler is SIG_IGN or SIG_DFL, * do not change the signal's entry in the handler array. * This allows a child of vfork(2) to set signal handlers * to SIG_IGN or SIG_DFL without affecting the parent. */ if (tvecp->sv_handler != SIG_DFL && tvecp->sv_handler != SIG_IGN) { handlers[newsig] = tvecp->sv_handler; tvecp->sv_handler = maphandler; } } if (ucbsigvec(newsig, tvecp, ovec) == -1) { handlers[newsig] = oldhand; return (-1); } if (ovec && ovec->sv_handler != SIG_DFL && ovec->sv_handler != SIG_IGN) ovec->sv_handler = oldhand; return (0); }
int _sigvec(int sig, struct sigvec *nvec, struct sigvec *ovec) { return (ucbsigvec(sig, nvec, ovec)); }