static int unblock_signal (int sig) { #ifdef SLANG_POSIX_SIGNALS sigset_t new_mask; sigemptyset (&new_mask); sigaddset (&new_mask, sig); (void) do_sigprocmask (SIG_UNBLOCK, &new_mask, NULL); #endif return 0; }
static void sigprocmask_intrinsic (void) { sigset_t mask, oldmask; SLang_Ref_Type *ref = NULL; int how; if (SLang_Num_Function_Args == 3) { if (-1 == SLang_pop_ref (&ref)) return; } if (-1 == pop_signal_mask (&mask)) { SLang_free_ref (ref); return; } if (-1 == SLang_pop_int (&how)) { SLang_free_ref (ref); return; } if ((how != SIG_BLOCK) && (how != SIG_UNBLOCK) && (how != SIG_SETMASK)) { _pSLang_verror (SL_InvalidParm_Error, "sigprocmask: invalid operation"); SLang_free_ref (ref); return; } do_sigprocmask (how, &mask, &oldmask); if (ref == NULL) return; if (-1 == assign_mask_to_ref (&oldmask, ref)) do_sigprocmask (SIG_SETMASK, &oldmask, NULL); SLang_free_ref (ref); }
int _pSLsig_block_and_call (int (*func)(VOID_STAR), VOID_STAR cd) { Signal_Type *s; int status; #ifdef SLANG_POSIX_SIGNALS sigset_t new_mask, old_mask; sigemptyset (&new_mask); #endif s = Signal_Table; while (s->name != NULL) { if (s->handler == NULL) { s++; continue; } #ifdef SLANG_POSIX_SIGNALS sigaddset (&new_mask, s->sig); #endif s++; } #ifdef SLANG_POSIX_SIGNALS (void) do_sigprocmask (SIG_BLOCK, &new_mask, &old_mask); #endif status = (*func) (cd); #ifdef SLANG_POSIX_SIGNALS (void) do_sigprocmask (SIG_SETMASK, &old_mask, NULL); #endif return status; }
static int block_signal (int sig, int *was_blocked) { #ifdef SLANG_POSIX_SIGNALS sigset_t new_mask; sigset_t old_mask; sigemptyset (&new_mask); sigaddset (&new_mask, sig); (void) do_sigprocmask (SIG_BLOCK, &new_mask, &old_mask); *was_blocked = sigismember (&old_mask, sig); return 0; #else *was_blocked = 0; return 0; #endif }
static uint32_t sys_linux_sigprocmask(uint32_t arg[]) { return do_sigprocmask((int)arg[0], (const sigset_t *)arg[1], (sigset_t *)arg[2]); }