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

Function sys_thread_sigprocmask

components/lwp/lwp_syscall.c:6816–6881  ·  view source on GitHub ↗

* @brief Manipulates the signal mask for the current thread. * * This function allows a thread to modify its signal mask, which controls which signals are blocked (prevented from delivery). * The signal mask can be modified by adding, removing, or setting the signal set as a whole, depending on the `how` parameter. * The `sigset` specifies the signals to be manipulated, and the current signal

Source from the content-addressed store, hash-verified

6814 * @see sys_sigaction(), sys_thread_sigpending()
6815 */
6816sysret_t sys_thread_sigprocmask(int how, const lwp_sigset_t *sigset, lwp_sigset_t *oset, size_t size)
6817{
6818 int ret = -1;
6819 lwp_sigset_t *pnewset = RT_NULL, *poldset = RT_NULL;
6820#ifdef ARCH_MM_MMU
6821 lwp_sigset_t newset, oldset;
6822#endif /* ARCH_MM_MMU */
6823
6824 if (!size)
6825 {
6826 return -EINVAL;
6827 }
6828 if (!oset && !sigset)
6829 {
6830 return -EINVAL;
6831 }
6832 if (size != sizeof(lwp_sigset_t))
6833 {
6834 return -EINVAL;
6835 }
6836 if (oset)
6837 {
6838#ifdef ARCH_MM_MMU
6839 if (!lwp_user_accessable((void *)oset, size))
6840 {
6841 return -EFAULT;
6842 }
6843 poldset = &oldset;
6844#else
6845 if (!lwp_user_accessable((void *)oset, size))
6846 {
6847 return -EFAULT;
6848 }
6849 poldset = oset;
6850#endif
6851 }
6852 if (sigset)
6853 {
6854#ifdef ARCH_MM_MMU
6855 if (!lwp_user_accessable((void *)sigset, size))
6856 {
6857 return -EFAULT;
6858 }
6859 lwp_get_from_user(&newset, (void *)sigset, sizeof(lwp_sigset_t));
6860 pnewset = &newset;
6861#else
6862 if (!lwp_user_accessable((void *)sigset, size))
6863 {
6864 return -EFAULT;
6865 }
6866 pnewset = (lwp_sigset_t *)sigset;
6867#endif
6868 }
6869 ret = lwp_thread_signal_mask(rt_thread_self(), mask_command_u2k[how], pnewset, poldset);
6870 if (ret < 0)
6871 {
6872 return ret;
6873 }

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