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