]>
Commit | Line | Data |
---|---|---|
514094f9 | 1 | <?xml version='1.0'?> |
3a54a157 ZJS |
2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> | |
0307f791 | 4 | <!-- SPDX-License-Identifier: LGPL-2.1+ --> |
d97eac36 | 5 | |
7647c01d LP |
6 | <refentry id="sd_bus_set_watch_bind" |
7 | xmlns:xi="http://www.w3.org/2001/XInclude"> | |
d97eac36 LP |
8 | |
9 | <refentryinfo> | |
10 | <title>sd_bus_set_watch_bind</title> | |
11 | <productname>systemd</productname> | |
d97eac36 LP |
12 | </refentryinfo> |
13 | ||
14 | <refmeta> | |
15 | <refentrytitle>sd_bus_set_watch_bind</refentrytitle> | |
16 | <manvolnum>3</manvolnum> | |
17 | </refmeta> | |
18 | ||
19 | <refnamediv> | |
20 | <refname>sd_bus_set_watch_bind</refname> | |
21 | <refname>sd_bus_get_watch_bind</refname> | |
22 | ||
23 | <refpurpose>Control socket binding watching on bus connections</refpurpose> | |
24 | </refnamediv> | |
25 | ||
26 | <refsynopsisdiv> | |
27 | <funcsynopsis> | |
28 | <funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo> | |
29 | ||
30 | <funcprototype> | |
31 | <funcdef>int <function>sd_bus_set_watch_bind</function></funcdef> | |
32 | <paramdef>sd_bus *<parameter>bus</parameter></paramdef> | |
33 | <paramdef>int <parameter>b</parameter></paramdef> | |
34 | </funcprototype> | |
35 | ||
36 | <funcprototype> | |
37 | <funcdef>int <function>sd_bus_get_watch_bind</function></funcdef> | |
38 | <paramdef>sd_bus *<parameter>bus</parameter></paramdef> | |
39 | </funcprototype> | |
40 | ||
41 | </funcsynopsis> | |
42 | </refsynopsisdiv> | |
43 | ||
44 | <refsect1> | |
45 | <title>Description</title> | |
46 | ||
47 | <para><function>sd_bus_set_watch_bind()</function> may be used to enable or disable client-side watching of server | |
48 | socket binding for a bus connection object. If the <parameter>b</parameter> is true, the feature is enabled, | |
49 | otherwise disabled (which is the default). When enabled, and the selected bus address refers to an | |
50 | <filename>AF_UNIX</filename> socket in the file system which does not exist while the connection attempt is made an | |
51 | <citerefentry><refentrytitle>inotify</refentrytitle><manvolnum>7</manvolnum></citerefentry> watch is installed on | |
52 | it, waiting for the socket to appear. As soon as the socket appears the connection is made. This functionality is | |
53 | useful in particular in early-boot programs that need to run before the system bus is available, but want to | |
54 | connect to it the instant it may be connected to.</para> | |
55 | ||
56 | <para><function>sd_bus_get_watch_bind()</function> may be used to query the current setting of this feature. It | |
57 | returns zero when the feature is disabled, and positive if enabled.</para> | |
58 | ||
59 | <para>Note that no timeout is applied while it is waited for the socket to appear. This means that any synchronous | |
60 | remote operation (such as | |
61 | <citerefentry><refentrytitle>sd_bus_call</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
62 | <citerefentry><refentrytitle>sd_bus_add_match</refentrytitle><manvolnum>3</manvolnum></citerefentry> or | |
63 | <citerefentry><refentrytitle>sd_bus_request_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>), that is | |
64 | used on a connection with this feature enabled that is not established yet might block unbounded if the socket is | |
65 | never created. However, asynchronous remote operations (such as | |
66 | <citerefentry><refentrytitle>sd_bus_send</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
67 | <citerefentry><refentrytitle>sd_bus_add_match_async</refentrytitle><manvolnum>3</manvolnum></citerefentry> or | |
68 | <citerefentry><refentrytitle>sd_bus_request_match_async</refentrytitle><manvolnum>3</manvolnum></citerefentry>) do | |
69 | not block in this case, and safely enqueue the requested operations to be dispatched the instant the connection is | |
70 | set up.</para> | |
71 | ||
72 | <para>Use <citerefentry><refentrytitle>sd_bus_is_ready</refentrytitle><manvolnum>3</manvolnum></citerefentry> to | |
73 | determine whether the connection is fully established, i.e. whether the peer socket has been bound, connected to | |
74 | and authenticated. Use | |
75 | <citerefentry><refentrytitle>sd_bus_set_connected_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry> to | |
76 | be notified when the connection is fully established.</para> | |
77 | ||
78 | </refsect1> | |
79 | ||
80 | <refsect1> | |
81 | <title>Return Value</title> | |
82 | ||
b1de39de ZJS |
83 | <para>On success, these functions return 0 or a positive integer. On failure, they return a negative |
84 | errno-style error code.</para> | |
d97eac36 | 85 | |
b1de39de ZJS |
86 | <refsect2> |
87 | <title>Errors</title> | |
d97eac36 | 88 | |
b1de39de | 89 | <para>Returned errors may indicate the following problems:</para> |
d97eac36 | 90 | |
b1de39de ZJS |
91 | <variablelist> |
92 | <varlistentry> | |
93 | <term><constant>-ECHILD</constant></term> | |
d97eac36 | 94 | |
b1de39de ZJS |
95 | <listitem><para>The bus connection has been created in a different process.</para></listitem> |
96 | </varlistentry> | |
97 | </variablelist> | |
98 | </refsect2> | |
d97eac36 LP |
99 | </refsect1> |
100 | ||
7647c01d | 101 | <xi:include href="libsystemd-pkgconfig.xml" /> |
d97eac36 LP |
102 | |
103 | <refsect1> | |
104 | <title>See Also</title> | |
105 | ||
106 | <para> | |
107 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
108 | <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
109 | <citerefentry><refentrytitle>inotify</refentrytitle><manvolnum>7</manvolnum></citerefentry>, | |
110 | <citerefentry><refentrytitle>sd_bus_call</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
111 | <citerefentry><refentrytitle>sd_bus_add_match</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
112 | <citerefentry><refentrytitle>sd_bus_request_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
113 | <citerefentry><refentrytitle>sd_bus_is_ready</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
114 | <citerefentry><refentrytitle>sd_bus_set_connected_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
115 | </para> | |
116 | </refsect1> | |
117 | ||
118 | </refentry> |