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 it is waited for the socket to
34 appear. 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 is not established
37 yet might block unbounded if the socket is never created. However,
38 asynchronous remote operations (such as sd_bus_send(3),
39 sd_bus_add_match_async(3) or sd_bus_request_match_async(3)) do not
40 block in this case, and safely enqueue the requested operations to be
41 dispatched the 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
53 Returned errors may indicate the following problems:
54
55 -ECHILD
56 The bus connection has been created in a different process.
57
59 sd_bus_set_watch_bind() and sd_bus_get_watch_bind() are available as a
60 shared library, which can be compiled and linked to with the
61 libsystemd pkg-config(1) file.
62
64 systemd(1), sd-bus(3), inotify(7), sd_bus_call(3), sd_bus_add_match(3),
65 sd_bus_request_name(3), sd_bus_is_ready(3),
66 sd_bus_set_connected_signal(3)
67
68
69
70systemd 239 SD_BUS_SET_WATCH_BIND(3)