[systemd-commits] 2 commits - src/libsystemd
Lennart Poettering
lennart at kemper.freedesktop.org
Thu Jun 5 04:53:25 PDT 2014
src/libsystemd/sd-bus/bus-util.c | 25 +++++++++++++++++++++++--
src/libsystemd/sd-event/sd-event.c | 5 ++++-
2 files changed, 27 insertions(+), 3 deletions(-)
New commits:
commit b27adf354a83ad25f4a209c0a6f7989ecab7b4e2
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Jun 5 13:31:25 2014 +0200
bus: make use of sd_bus_try_close() in exit-on-idle services
diff --git a/src/libsystemd/sd-bus/bus-util.c b/src/libsystemd/sd-bus/bus-util.c
index 6bd21cc..6441c5b 100644
--- a/src/libsystemd/sd-bus/bus-util.c
+++ b/src/libsystemd/sd-bus/bus-util.c
@@ -43,7 +43,9 @@ static int name_owner_change_callback(sd_bus *bus, sd_bus_message *m, void *user
assert(m);
assert(e);
+ sd_bus_close(bus);
sd_event_exit(e, 0);
+
return 1;
}
@@ -121,11 +123,30 @@ int bus_event_loop_with_idle(
return r;
if (r == 0 && !exiting) {
- r = bus_async_unregister_and_exit(e, bus, name);
+
+ r = sd_bus_try_close(bus);
+ if (r == -EBUSY)
+ continue;
+
+ if (r == -ENOTSUP) {
+ /* Fallback for dbus1 connections: we
+ * unregister the name and wait for
+ * the response to come through for
+ * it */
+
+ r = bus_async_unregister_and_exit(e, bus, name);
+ if (r < 0)
+ return r;
+
+ exiting = true;
+ continue;
+ }
+
if (r < 0)
return r;
- exiting = true;
+ sd_event_exit(e, 0);
+ break;
}
}
commit eec6022cf039e62233139000b9e95db943959e48
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Jun 5 13:43:30 2014 +0200
sd-event: restore correct timeout behaviour
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index c48fa37..53f1904 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -2180,6 +2180,7 @@ _public_ int sd_event_run(sd_event *e, uint64_t timeout) {
unsigned ev_queue_max;
sd_event_source *p;
int r, i, m;
+ bool timedout;
assert_return(e, -EINVAL);
assert_return(!event_pid_changed(e), -ECHILD);
@@ -2226,6 +2227,8 @@ _public_ int sd_event_run(sd_event *e, uint64_t timeout) {
goto finish;
}
+ timedout = m == 0;
+
dual_timestamp_get(&e->timestamp);
e->timestamp_boottime = now(CLOCK_BOOTTIME);
@@ -2278,7 +2281,7 @@ _public_ int sd_event_run(sd_event *e, uint64_t timeout) {
p = event_next_pending(e);
if (!p) {
- r = 1;
+ r = !timedout;
goto finish;
}
More information about the systemd-commits
mailing list