int selfpipe_trapset (sigset_t const *set) { unsigned int i = 1 ; if (selfpipe_fd < 0) return (errno = EBADF, -1) ; for (; i <= NSIG ; i++) { register int h = sigismember(set, i) ; if (h < 0) continue ; if (h) { if (sig_catcha(i, &selfpipe_ssa) < 0) break ; } else if (sigismember(&selfpipe_caught, i)) { if (sig_restore(i) < 0) break ; } } if (i <= NSIG) { int e = errno ; sig_restoreto(set, i) ; errno = e ; return -1 ; } selfpipe_caught = *set ; return 0 ; }
int sig_catch (int sig, skasighandler_t_ref f) { struct skasigaction ssa = { f, SKASA_MASKALL | SKASA_NOCLDSTOP } ; return sig_catcha(sig, &ssa) ; }