1SD_BUS_SET_WATCH_BIND(3) sd_bus_set_watch_bind SD_BUS_SET_WATCH_BIND(3)
2
3
4
6 sd_bus_set_watch_bind, sd_bus_get_watch_bind - Control socket binding
7 watching on bus connections
8
10 #include <systemd/sd-bus.h>
11
12 int sd_bus_set_watch_bind(sd_bus *bus, int b);
13
14 int sd_bus_get_watch_bind(sd_bus *bus);
15
17 sd_bus_set_watch_bind() may be used to enable or disable client-side
18 watching of server socket binding for a bus connection object. If the b
19 is true, the feature is enabled, otherwise disabled (which is the
20 default). When enabled, and the selected bus address refers to an
21 AF_UNIX socket in the file system which does not exist while the
22 connection attempt is made an inotify(7) watch is installed on it,
23 waiting for the socket to appear. As soon as the socket appears the
24 connection is made. This functionality is useful in particular in
25 early-boot programs that need to run before the system bus is
26 available, but want to connect to it the instant it may be connected
27 to.
28
29 sd_bus_get_watch_bind() may be used to query the current setting of
30 this feature. It returns zero when the feature is disabled, and
31 positive if enabled.
32
33 Note that no timeout is applied while we wait for the socket to appear.
34 This means that any synchronous remote operation (such as
35 sd_bus_call(3), sd_bus_add_match(3) or sd_bus_request_name(3)), that is
36 used on a connection with this feature enabled that hasn't been
37 established yet, might block forever if the socket is never created.
38 However, asynchronous remote operations (such as sd_bus_send(3),
39 sd_bus_call_async(3), sd_bus_add_match_async(3)) do not block in this
40 case, and safely enqueue the requested operations to be dispatched the
41 instant the connection is set up.
42
43 Use sd_bus_is_ready(3) to determine whether the connection is fully
44 established, i.e. whether the peer socket has been bound, connected to
45 and authenticated. Use sd_bus_set_connected_signal(3) to be notified
46 when the connection is fully established.
47
49 On success, these functions return 0 or a positive integer. On failure,
50 they return a negative errno-style error code.
51
52 Errors
53 Returned errors may indicate the following problems:
54
55 -ECHILD
56 The bus connection has been created in a different process.
57
59 These APIs are implemented as a shared library, which can be compiled
60 and linked to with the libsystemd pkg-config(1) file.
61
63 systemd(1), sd-bus(3), inotify(7), sd_bus_call(3), sd_bus_add_match(3),
64 sd_bus_request_name(3), sd_bus_is_ready(3),
65 sd_bus_set_connected_signal(3)
66
67
68
69systemd 250 SD_BUS_SET_WATCH_BIND(3)