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