MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / sys_sigprocmask

Function sys_sigprocmask

components/lwp/lwp_syscall.c:6535–6600  ·  view source on GitHub ↗

* @brief Sets or retrieves the signal mask for the calling process. * * This system call allows the caller to block or unblock signals by modifying the signal mask. The signal * mask determines which signals are blocked and which signals can be delivered to the process. The * function can also be used to retrieve the current signal mask. * * @param[in] how The action to be taken on the

Source from the content-addressed store, hash-verified

6533 * @see sys_sigaction(), sys_sigpending()
6534 */
6535sysret_t sys_sigprocmask(int how, const sigset_t *sigset, sigset_t *oset, size_t size)
6536{
6537 int ret = -1;
6538 lwp_sigset_t *pnewset = RT_NULL, *poldset = RT_NULL;
6539#ifdef ARCH_MM_MMU
6540 lwp_sigset_t newset, oldset;
6541#endif /* ARCH_MM_MMU*/
6542
6543 if (!size)
6544 {
6545 return -EINVAL;
6546 }
6547 if (!oset && !sigset)
6548 {
6549 return -EINVAL;
6550 }
6551 if (size > sizeof(lwp_sigset_t))
6552 {
6553 size = sizeof(lwp_sigset_t);
6554 }
6555 if (oset)
6556 {
6557#ifdef ARCH_MM_MMU
6558 if (!lwp_user_accessable((void *)oset, size))
6559 {
6560 return -EFAULT;
6561 }
6562 poldset = &oldset;
6563#else
6564 if (!lwp_user_accessable((void *)oset, size))
6565 {
6566 return -EFAULT;
6567 }
6568 poldset = (lwp_sigset_t *)oset;
6569#endif
6570 }
6571 if (sigset)
6572 {
6573#ifdef ARCH_MM_MMU
6574 if (!lwp_user_accessable((void *)sigset, size))
6575 {
6576 return -EFAULT;
6577 }
6578 lwp_get_from_user(&newset, (void *)sigset, size);
6579 pnewset = &newset;
6580#else
6581 if (!lwp_user_accessable((void *)sigset, size))
6582 {
6583 return -EFAULT;
6584 }
6585 pnewset = (lwp_sigset_t *)sigset;
6586#endif /* ARCH_MM_MMU */
6587 }
6588 ret = lwp_thread_signal_mask(rt_thread_self(), mask_command_u2k[how], pnewset, poldset);
6589#ifdef ARCH_MM_MMU
6590 if (ret < 0)
6591 {
6592 return ret;

Callers

nothing calls this directly

Calls 5

lwp_user_accessableFunction · 0.85
lwp_get_from_userFunction · 0.85
lwp_thread_signal_maskFunction · 0.85
rt_thread_selfFunction · 0.85
lwp_put_to_userFunction · 0.85

Tested by

no test coverage detected