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, library
50 or module instance.
51
53 Functions described here are available as a shared library, which can
54 be compiled against and linked to with the libsystemd pkg-config(1)
55 file.
56
57 The code described here uses getenv(3), which is declared to be not
58 multi-thread-safe. This means that the code calling the functions
59 described here must not call setenv(3) from a parallel thread. It is
60 recommended to only do calls to setenv() from an early phase of the
61 program when no other threads have been started.
62
64 systemd(1), sd-bus(3), sd_bus_start(3), sd_bus_close(3),
65 sd_bus_set_connected_signal(3)
66
67
68
69systemd 254 SD_BUS_IS_OPEN(3)