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