1
1
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:
Lennart Poettering 2019-10-30 17:37:00 +01:00
parent f8f3f9263e
commit 90b15e18ee
2 changed files with 17 additions and 0 deletions

View File

@ -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;
}

View File

@ -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);