50 likes | 255 Views
Sigprocmask. Siv & Daisy. int sigprocmask ( int how, const sigset_t *restrict set, sigset_t *restrict oldset ). How : (how the signal mask is changed) SIG_BLOCK: block the signal in set SIG_UNBLOCK: unblock the signal in set SIG_SETMASK: use set for mask, and ignore the previous one.
E N D
Sigprocmask Siv&Daisy
intsigprocmask (int how, constsigset_t *restrict set, sigset_t *restrict oldset) • How:(howthesignalmaskischanged) SIG_BLOCK:blockthesignalinset SIG_UNBLOCK:unblockthesignalinset SIG_SETMASK:usesetformask,andignorethepreviousone
intsigprocmask (int how, constsigset_t *restrict set, sigset_t *restrict oldset) • Set:(thesignalmask) • Null:nochangetothesignalmask(howisignored) • Oldset:(to return information about the old process signal mask ) • Null:ifwanttodonothingaboutit • Non-null: previous valueofsignalmaskisstored • Returnvalue: • 0:success;-1error
Assume that the old blocking list was {SIGSEGV, SIGSUSP} sigset_t x; sigemptyset (&x); sigaddset(&x, SIGUSR1); sigprocmask(SIG_BLOCK,&x, NULL) • EX w/t old_set: blocking list will now be:{SIGSEGV, SIGSUSP, SIGUSR1} sigprocmask(SIG_UNBLOCK, &x, NULL) blocking list will go back : {SIGSEGV, SIGSUSP} sigprocmask(SIG_SETMASK, &x, NULL) blocking list will now be set to {SIGUSR1}
EXwithOld_set sigset_ty; sigprocmask(SIG_BLOCK, &x, &y) Ynowbecomes:{SIGSEGV,SIGSUSP} Blocklist:{SIGSEGV, SIGSUSP, SIGUSR1} sigprocmask(SIG_UNBLOCK, &x, &y) Y nowbecomes:{SIGSEGV, SIGSUSP, SIGUSR1} Blocklist:{SIGSEGV, SIGSUSP} sigprocmask(SIG_SET, &x, &y) Y nowbecomes:{SIGSEGV, SIGSUSP} Blocklist:{SIGUSR1}