summaryrefslogtreecommitdiff
path: root/src/libelogind/sd-bus/sd-bus.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-12-19 15:47:09 +0100
committerSven Eden <yamakuzure@gmx.net>2018-05-30 07:49:59 +0200
commit15196ff2d3e084b05e60c2ff61f71d1ff40bb3a5 (patch)
treeeafbf44f9049e6f2ca26170f9d858d7d47e2176d /src/libelogind/sd-bus/sd-bus.c
parent4e6c30f09491bfae763107482d76c4af4f9f6681 (diff)
sd-bus: add new sd_bus_is_ready() API
This new call is much light sd_bus_is_open(), but returns true only if the connection is fully set up, i.e. after we finished with the authentication and Hello() phase. This API is useful for clients in particular when using the "watch_bind" feature, as that way it can be determined in advance whether it makes sense to sync on some operation.
Diffstat (limited to 'src/libelogind/sd-bus/sd-bus.c')
-rw-r--r--src/libelogind/sd-bus/sd-bus.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libelogind/sd-bus/sd-bus.c b/src/libelogind/sd-bus/sd-bus.c
index 5976e6d28..14d90903d 100644
--- a/src/libelogind/sd-bus/sd-bus.c
+++ b/src/libelogind/sd-bus/sd-bus.c
@@ -1411,6 +1411,13 @@ _public_ int sd_bus_is_open(sd_bus *bus) {
return BUS_IS_OPEN(bus->state);
}
+_public_ int sd_bus_is_ready(sd_bus *bus) {
+ assert_return(bus, -EINVAL);
+ assert_return(!bus_pid_changed(bus), -ECHILD);
+
+ return bus->state == BUS_RUNNING;
+}
+
_public_ int sd_bus_can_send(sd_bus *bus, char type) {
int r;