summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd-bus/sd-event.c10
-rw-r--r--src/systemd/sd-event.h3
2 files changed, 11 insertions, 2 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;
diff --git a/src/systemd/sd-event.h b/src/systemd/sd-event.h
index 1fd5648636..6ff85addb1 100644
--- a/src/systemd/sd-event.h
+++ b/src/systemd/sd-event.h
@@ -35,8 +35,6 @@
- Scales better with a large number of time events, since it doesn't require one timerfd each
- Automatically tries to coalesce timer events system-wide
- Handles signals and child PIDs
-
- TODO: rename mute to enable?
*/
typedef struct sd_event sd_event;
@@ -101,6 +99,7 @@ int sd_event_source_get_time(sd_event_source *s, uint64_t *usec);
int sd_event_source_set_time(sd_event_source *s, uint64_t usec);
int sd_event_source_set_time_accuracy(sd_event_source *s, uint64_t usec);
int sd_event_source_get_time_accuracy(sd_event_source *s, uint64_t *usec);
+int sd_event_source_get_child_pid(sd_event_source *s, pid_t *pid);
int sd_event_source_set_prepare(sd_event_source *s, sd_prepare_handler_t callback);
void* sd_event_source_get_userdata(sd_event_source *s);