diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-10-11 01:33:25 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-10-11 01:33:25 +0200 |
commit | 4bee801296daef257c64647353a1815d46fe2a34 (patch) | |
tree | 87d21c74816c467cdded641c4cf994c54ed23f91 /src/libsystemd-bus | |
parent | baf762833224267ef5380fb83b22f294628695a8 (diff) |
event: add sd_event_source_get_child_pid() call to query the PID of a child event source
Diffstat (limited to 'src/libsystemd-bus')
-rw-r--r-- | src/libsystemd-bus/sd-event.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libsystemd-bus/sd-event.c b/src/libsystemd-bus/sd-event.c index 3094d9e297..482e3bb8a5 100644 --- a/src/libsystemd-bus/sd-event.c +++ b/src/libsystemd-bus/sd-event.c @@ -1297,6 +1297,16 @@ int sd_event_source_get_time_accuracy(sd_event_source *s, uint64_t *usec) { return 0; } +int sd_event_source_get_child_pid(sd_event_source *s, pid_t *pid) { + assert_return(s, -EINVAL); + assert_return(pid, -EINVAL); + assert_return(s->type == SOURCE_CHILD, -EDOM); + assert_return(!event_pid_changed(s->event), -ECHILD); + + *pid = s->child.pid; + return 0; +} + int sd_event_source_set_prepare(sd_event_source *s, sd_prepare_handler_t callback) { int r; |