Lines Matching +full:un +full:- +full:masked

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
41 #include "un-namespace.h"
65 return (&_thr_sigact[signo - 1]); in __libc_sigaction_slot()
97 if (curthread->sigblock > 0) { in thr_signal_block_slow()
98 curthread->sigblock++; in thr_signal_block_slow()
101 __sys_sigprocmask(SIG_BLOCK, &_thr_maskset, &curthread->sigmask); in thr_signal_block_slow()
102 curthread->sigblock++; in thr_signal_block_slow()
108 if (--curthread->sigblock == 0) in thr_signal_unblock_slow()
109 __sys_sigprocmask(SIG_SETMASK, &curthread->sigmask, NULL); in thr_signal_unblock_slow()
115 atomic_add_32(&curthread->fsigblock, SIGFASTBLOCK_INC); in thr_signal_block_fast()
123 oldval = atomic_fetchadd_32(&curthread->fsigblock, -SIGFASTBLOCK_INC); in thr_signal_unblock_fast()
164 __sys_sigfastblock(SIGFASTBLOCK_SETPTR, &curthread->fsigblock); in _thr_signal_block_setup()
188 return thr_kill(thread->tid, sig); in _thr_send_sig()
224 * The signal handler wrapper is entered with all signal masked.
239 _thr_rwl_rdlock(&usa->lock); in thr_sighandler()
240 act = usa->sigact; in thr_sighandler()
241 _thr_rwl_unlock(&usa->lock); in thr_sighandler()
243 curthread->deferred_run = 0; in thr_sighandler()
253 memcpy(&curthread->deferred_sigact, &act, sizeof(struct sigaction)); in thr_sighandler()
254 memcpy(&curthread->deferred_siginfo, info, sizeof(siginfo_t)); in thr_sighandler()
255 curthread->deferred_sigmask = ucp->uc_sigmask; in thr_sighandler()
257 ucp->uc_sigmask = _thr_deferset; in thr_sighandler()
276 SIGSETOR(actp->sa_mask, ucp->uc_sigmask); in handle_signal()
279 if (!(actp->sa_flags & SA_NODEFER)) in handle_signal()
280 SIGADDSET(actp->sa_mask, sig); in handle_signal()
282 in_sigsuspend = curthread->in_sigsuspend; in handle_signal()
283 curthread->in_sigsuspend = 0; in handle_signal()
294 cancel_point = curthread->cancel_point; in handle_signal()
295 cancel_async = curthread->cancel_async; in handle_signal()
296 cancel_enable = curthread->cancel_enable; in handle_signal()
297 curthread->cancel_point = 0; in handle_signal()
299 curthread->cancel_enable = 0; in handle_signal()
302 __sys_sigprocmask(SIG_SETMASK, &actp->sa_mask, NULL); in handle_signal()
304 sigfunc = actp->sa_sigaction; in handle_signal()
312 * re-set cancel_enable flag by calling pthread_setcancelstate(). in handle_signal()
314 if ((actp->sa_flags & SA_SIGINFO) != 0) { in handle_signal()
317 ((ohandler)sigfunc)(sig, info->si_code, in handle_signal()
318 (struct sigcontext *)ucp, info->si_addr, in handle_signal()
323 curthread->in_sigsuspend = in_sigsuspend; in handle_signal()
324 curthread->cancel_point = cancel_point; in handle_signal()
325 curthread->cancel_enable = cancel_enable; in handle_signal()
327 SIGDELSET(ucp->uc_sigmask, SIGCANCEL); in handle_signal()
350 if (__predict_true(!curthread->cancel_pending || in check_cancel()
351 !curthread->cancel_enable || curthread->no_cancel)) in check_cancel()
362 * non-zero cancel_point means we are already in in check_cancel()
374 if (curthread->cancel_point) { in check_cancel()
375 if (curthread->in_sigsuspend) { in check_cancel()
377 SIGADDSET(ucp->uc_sigmask, SIGCANCEL); in check_cancel()
378 curthread->unblock_sigcancel = 1; in check_cancel()
382 thr_wake(curthread->tid); in check_cancel()
383 } else if (curthread->cancel_async) { in check_cancel()
389 &ucp->uc_sigmask : NULL); in check_cancel()
401 if (__predict_true(curthread->deferred_siginfo.si_signo == 0 || in check_deferred_signal()
402 curthread->deferred_run)) in check_deferred_signal()
405 curthread->deferred_run = 1; in check_deferred_signal()
409 if (curthread->deferred_siginfo.si_signo == 0) { in check_deferred_signal()
410 curthread->deferred_run = 0; in check_deferred_signal()
414 act = curthread->deferred_sigact; in check_deferred_signal()
415 uc->uc_sigmask = curthread->deferred_sigmask; in check_deferred_signal()
416 memcpy(&info, &curthread->deferred_siginfo, sizeof(siginfo_t)); in check_deferred_signal()
418 curthread->deferred_siginfo.si_signo = 0; in check_deferred_signal()
428 if (__predict_true((curthread->flags & (THR_FLAGS_NEED_SUSPEND | in check_suspend()
433 if (curthread->force_exit) in check_suspend()
446 curthread->critical_count++; in check_suspend()
447 THR_UMUTEX_LOCK(curthread, &(curthread)->lock); in check_suspend()
448 while ((curthread->flags & THR_FLAGS_NEED_SUSPEND) != 0) { in check_suspend()
449 curthread->cycle++; in check_suspend()
450 cycle = curthread->cycle; in check_suspend()
453 _thr_umtx_wake(&curthread->cycle, INT_MAX, 0); in check_suspend()
459 if (curthread->state == PS_DEAD) in check_suspend()
461 curthread->flags |= THR_FLAGS_SUSPENDED; in check_suspend()
462 THR_UMUTEX_UNLOCK(curthread, &(curthread)->lock); in check_suspend()
463 _thr_umtx_wait_uint(&curthread->cycle, cycle, NULL, 0); in check_suspend()
464 THR_UMUTEX_LOCK(curthread, &(curthread)->lock); in check_suspend()
466 THR_UMUTEX_UNLOCK(curthread, &(curthread)->lock); in check_suspend()
467 curthread->critical_count--; in check_suspend()
486 if (error == -1 || oact.sa_handler == SIG_DFL || in _thr_signal_init()
490 usa->sigact = oact; in _thr_signal_init()
492 remove_thr_signals(&usa->sigact.sa_mask); in _thr_signal_init()
529 actp = &usa->sigact; in _thr_sigact_unload()
531 handler = actp->sa_handler; in _thr_sigact_unload()
534 rwlp = &usa->lock; in _thr_sigact_unload()
536 if (handler != actp->sa_handler) { in _thr_sigact_unload()
540 actp->sa_handler = SIG_DFL; in _thr_sigact_unload()
541 actp->sa_flags = SA_SIGINFO; in _thr_sigact_unload()
542 SIGEMPTYSET(actp->sa_mask); in _thr_sigact_unload()
560 _thr_rwl_rdlock(&__libc_sigaction_slot(i)->lock); in _thr_signal_prefork()
569 _thr_rwl_unlock(&__libc_sigaction_slot(i)->lock); in _thr_signal_postfork()
578 bzero(&__libc_sigaction_slot(i) -> lock, in _thr_signal_postfork_child()
598 return (-1); in __thr_sigaction()
606 _thr_rwl_wrlock(&usa->lock); in __thr_sigaction()
609 oldact2 = usa->sigact; in __thr_sigaction()
621 usa->sigact = newact; in __thr_sigaction()
622 remove_thr_signals(&usa->sigact.sa_mask); in __thr_sigaction()
629 if (ret == -1) { in __thr_sigaction()
631 usa->sigact = oldact2; in __thr_sigaction()
642 oldact = usa->sigact; in __thr_sigaction()
645 _thr_rwl_unlock(&usa->lock); in __thr_sigaction()
694 old = curthread->in_sigsuspend; in __thr_sigsuspend()
695 curthread->in_sigsuspend = 1; in __thr_sigsuspend()
699 curthread->in_sigsuspend = old; in __thr_sigsuspend()
700 if (curthread->unblock_sigcancel) { in __thr_sigsuspend()
701 curthread->unblock_sigcancel = 0; in __thr_sigsuspend()
736 _thr_cancel_leave(curthread, (ret == -1)); in __thr_sigtimedwait()
762 _thr_cancel_leave(curthread, ret == -1); in __thr_sigwaitinfo()
801 return (-1); in __thr_setcontext()
803 if (!SIGISMEMBER(ucp->uc_sigmask, SIGCANCEL)) in __thr_setcontext()
817 return (-1); in __thr_swapcontext()
819 if (SIGISMEMBER(ucp->uc_sigmask, SIGCANCEL)) { in __thr_swapcontext()