mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-02-04 17:47:03 +03:00
signal-util: add new helper signal_is_blocked()
This commit is contained in:
parent
f8f3f9263e
commit
90b15e18ee
@ -287,3 +287,18 @@ int signal_from_string(const char *s) {
|
||||
void nop_signal_handler(int sig) {
|
||||
/* nothing here */
|
||||
}
|
||||
|
||||
int signal_is_blocked(int sig) {
|
||||
sigset_t ss;
|
||||
int r;
|
||||
|
||||
r = pthread_sigmask(SIG_SETMASK, NULL, &ss);
|
||||
if (r != 0)
|
||||
return -r;
|
||||
|
||||
r = sigismember(&ss, sig);
|
||||
if (r < 0)
|
||||
return -errno;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -41,3 +41,5 @@ static inline const char* signal_to_string_with_check(int n) {
|
||||
|
||||
return signal_to_string(n);
|
||||
}
|
||||
|
||||
int signal_is_blocked(int sig);
|
||||
|
Loading…
x
Reference in New Issue
Block a user