summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/sd-event.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-12-13 04:14:25 +0100
committerLennart Poettering <lennart@poettering.net>2013-12-13 15:30:12 +0100
commit8f726607ece2b49980152a53845aefde858768a5 (patch)
treeb042f7f1a8e7d9ba06741527bc7c03ccc25cc85c /src/libsystemd-bus/sd-event.c
parentf9f4dd51bdb016bab84f7fb3cf47a2ad102b4c76 (diff)
event: allow to query userdata and watchdog state
Diffstat (limited to 'src/libsystemd-bus/sd-event.c')
-rw-r--r--src/libsystemd-bus/sd-event.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libsystemd-bus/sd-event.c b/src/libsystemd-bus/sd-event.c
index 6af52ecb3c..65ee12d5ff 100644
--- a/src/libsystemd-bus/sd-event.c
+++ b/src/libsystemd-bus/sd-event.c
@@ -1371,6 +1371,17 @@ _public_ void* sd_event_source_get_userdata(sd_event_source *s) {
return s->userdata;
}
+_public_ void *sd_event_source_set_userdata(sd_event_source *s, void *userdata) {
+ void *ret;
+
+ assert_return(s, NULL);
+
+ ret = s->userdata;
+ s->userdata = userdata;
+
+ return ret;
+}
+
static usec_t sleep_between(sd_event *e, usec_t a, usec_t b) {
usec_t c;
assert(e);
@@ -2078,6 +2089,7 @@ _public_ int sd_event_set_watchdog(sd_event *e, int b) {
int r;
assert_return(e, -EINVAL);
+ assert_return(!event_pid_changed(e), -ECHILD);
if (e->watchdog == !!b)
return e->watchdog;
@@ -2133,3 +2145,10 @@ fail:
e->watchdog_fd = -1;
return r;
}
+
+_public_ int sd_event_get_watchdog(sd_event *e) {
+ assert_return(e, -EINVAL);
+ assert_return(!event_pid_changed(e), -ECHILD);
+
+ return e->watchdog;
+}