diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-06-15 20:13:23 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-06-15 20:13:23 +0200 |
commit | 72c0a2c255b172ebbb2a2b7dab7c9aec4c9582d9 (patch) | |
tree | 09bd6f8db366a0a611de79dc08d88902d10f6a75 /src/libsystemd | |
parent | a4c8a5995102144225439c0077bbda5325761986 (diff) |
everywhere: port everything to sigprocmask_many() and friends
This ports a lot of manual code over to sigprocmask_many() and friends.
Also, we now consistly check for sigprocmask() failures with
assert_se(), since the call cannot realistically fail unless there's a
programming error.
Also encloses a few sd_event_add_signal() calls with (void) when we
ignore the return values for it knowingly.
Diffstat (limited to 'src/libsystemd')
-rw-r--r-- | src/libsystemd/sd-event/test-event.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/libsystemd/sd-event/test-event.c b/src/libsystemd/sd-event/test-event.c index 94e98e0077..408e1679a2 100644 --- a/src/libsystemd/sd-event/test-event.c +++ b/src/libsystemd/sd-event/test-event.c @@ -79,7 +79,6 @@ static int child_handler(sd_event_source *s, const siginfo_t *si, void *userdata static int signal_handler(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) { sd_event_source *p = NULL; - sigset_t ss; pid_t pid; assert_se(s); @@ -89,9 +88,7 @@ static int signal_handler(sd_event_source *s, const struct signalfd_siginfo *si, assert_se(userdata == INT_TO_PTR('e')); - assert_se(sigemptyset(&ss) >= 0); - assert_se(sigaddset(&ss, SIGCHLD) >= 0); - assert_se(sigprocmask(SIG_BLOCK, &ss, NULL) >= 0); + assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGCHLD, -1) >= 0); pid = fork(); assert_se(pid >= 0); @@ -109,7 +106,6 @@ static int signal_handler(sd_event_source *s, const struct signalfd_siginfo *si, static int defer_handler(sd_event_source *s, void *userdata) { sd_event_source *p = NULL; - sigset_t ss; assert_se(s); @@ -117,9 +113,8 @@ static int defer_handler(sd_event_source *s, void *userdata) { assert_se(userdata == INT_TO_PTR('d')); - assert_se(sigemptyset(&ss) >= 0); - assert_se(sigaddset(&ss, SIGUSR1) >= 0); - assert_se(sigprocmask(SIG_BLOCK, &ss, NULL) >= 0); + assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGUSR1, -1) >= 0); + assert_se(sd_event_add_signal(sd_event_source_get_event(s), &p, SIGUSR1, signal_handler, INT_TO_PTR('e')) >= 0); assert_se(sd_event_source_set_enabled(p, SD_EVENT_ONESHOT) >= 0); raise(SIGUSR1); @@ -209,7 +204,7 @@ int main(int argc, char *argv[]) { assert_se(sd_event_source_set_prepare(z, prepare_handler) >= 0); /* Test for floating event sources */ - assert_se(sigprocmask_many(SIG_BLOCK, SIGRTMIN+1, -1) == 0); + assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGRTMIN+1, -1) >= 0); assert_se(sd_event_add_signal(e, NULL, SIGRTMIN+1, NULL, NULL) >= 0); assert_se(write(a[1], &ch, 1) >= 0); |