1SD_BUS_IS_OPEN(3) sd_bus_is_open SD_BUS_IS_OPEN(3)
2
3
4
6 sd_bus_is_open, sd_bus_is_ready - Check whether the bus connection is
7 open or ready
8
10 #include <systemd/sd-bus.h>
11
12 int sd_bus_is_open(sd_bus *bus);
13
14 int sd_bus_is_ready(sd_bus *bus);
15
17 sd_bus_is_open() checks whether the specified bus connection is open,
18 i.e. in the process of being established, already established or in the
19 process of being torn down. It returns zero when the connection has not
20 been started yet (i.e. sd_bus_start(3) or some equivalent call has not
21 been invoked yet), or is fully terminated again (for example after
22 sd_bus_close(3)), it returns positive otherwise.
23
24 sd_bus_is_ready() checks whether the specified connection is fully
25 established, i.e. completed the connection and authentication phases of
26 the protocol and received the Hello() method call response, and is not
27 in the process of being torn down again. It returns zero outside of
28 this state, and positive otherwise. Effectively, this function returns
29 positive while regular messages can be sent or received on the
30 connection.
31
32 The bus argument may be NULL, zero is also returned in that case.
33
34 To be notified when the connection is fully established, use
35 sd_bus_set_connected_signal(3) and install a match for the Connected()
36 signal on the "org.freedesktop.DBus.Local" interface. To be notified
37 when the connection is torn down again, install a match for the
38 Disconnected() signal on the "org.freedesktop.DBus.Local" interface.
39
41 Those functions return 0 if the bus is not in the given state, and a
42 positive integer when it is. On failure, a negative errno-style error
43 code is returned.
44
45 Errors
46 Returned errors may indicate the following problems:
47
48 -ECHILD
49 The bus connection has been created in a different process.
50
52 These APIs are implemented as a shared library, which can be compiled
53 and linked to with the libsystemd pkg-config(1) file.
54
56 systemd(1), sd-bus(3), sd_bus_start(3), sd_bus_close(3),
57 sd_bus_set_connected_signal(3)
58
59
60
61systemd 249 SD_BUS_IS_OPEN(3)