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