diff options
author | Sven Eden <yamakuzure@gmx.net> | 2017-04-06 14:56:03 +0200 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2017-04-26 12:59:13 +0200 |
commit | da4b83e77bc603745cf4a365d7f013301ef7fa89 (patch) | |
tree | 293d9508eeb1f841c71b0b0517287fd398aded82 /src/libelogind/sd-event | |
parent | eaca07ccfdf5d7dabc50afc7e539c2413dd69d3e (diff) |
Prep v228: Add remaining updates from upstream (3/3)
Apply remaining fixes and the performed move of utility functions
into their own foo-util.[hc] files on the rest of elogind.
Diffstat (limited to 'src/libelogind/sd-event')
-rw-r--r-- | src/libelogind/sd-event/sd-event.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/libelogind/sd-event/sd-event.c b/src/libelogind/sd-event/sd-event.c index f6d0d1054..d26efb828 100644 --- a/src/libelogind/sd-event/sd-event.c +++ b/src/libelogind/sd-event/sd-event.c @@ -23,19 +23,23 @@ #include <sys/timerfd.h> #include <sys/wait.h> -#include "sd-id128.h" #include "sd-daemon.h" -#include "macro.h" -#include "prioq.h" +#include "sd-event.h" +#include "sd-id128.h" + +#include "alloc-util.h" +#include "fd-util.h" #include "hashmap.h" -#include "util.h" -#include "time-util.h" +#include "list.h" +#include "macro.h" #include "missing.h" +#include "prioq.h" +#include "process-util.h" #include "set.h" -#include "list.h" #include "signal-util.h" - -#include "sd-event.h" +#include "string-util.h" +#include "time-util.h" +#include "util.h" #define DEFAULT_ACCURACY_USEC (250 * USEC_PER_MSEC) @@ -808,7 +812,7 @@ static void source_disconnect(sd_event_source *s) { s->event->n_enabled_child_sources--; } - (void) hashmap_remove(s->event->child_sources, INT_TO_PTR(s->child.pid)); + (void) hashmap_remove(s->event->child_sources, PID_TO_PTR(s->child.pid)); event_gc_signal_data(s->event, &s->priority, SIGCHLD); } @@ -1126,8 +1130,8 @@ _public_ int sd_event_add_signal( callback = signal_exit_callback; r = pthread_sigmask(SIG_SETMASK, NULL, &ss); - if (r < 0) - return -errno; + if (r != 0) + return -r; if (!sigismember(&ss, sig)) return -EBUSY; @@ -1190,7 +1194,7 @@ _public_ int sd_event_add_child( if (r < 0) return r; - if (hashmap_contains(e->child_sources, INT_TO_PTR(pid))) + if (hashmap_contains(e->child_sources, PID_TO_PTR(pid))) return -EBUSY; s = source_new(e, !ret, SOURCE_CHILD); @@ -1203,7 +1207,7 @@ _public_ int sd_event_add_child( s->userdata = userdata; s->enabled = SD_EVENT_ONESHOT; - r = hashmap_put(e->child_sources, INT_TO_PTR(pid), s); + r = hashmap_put(e->child_sources, PID_TO_PTR(pid), s); if (r < 0) { source_free(s); return r; |