]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_bus_is_open.xml
Merge pull request #11580 from yuwata/fix-11579
[thirdparty/systemd.git] / man / sd_bus_is_open.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_is_open"
10 xmlns:xi="http://www.w3.org/2001/XInclude">
11
12 <refentryinfo>
13 <title>sd_bus_is_open</title>
14 <productname>systemd</productname>
15 </refentryinfo>
16
17 <refmeta>
18 <refentrytitle>sd_bus_is_open</refentrytitle>
19 <manvolnum>3</manvolnum>
20 </refmeta>
21
22 <refnamediv>
23 <refname>sd_bus_is_open</refname>
24 <refname>sd_bus_is_ready</refname>
25
26 <refpurpose>Check whether the a bus connection is open or ready.</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_is_open</function></funcdef>
35 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
36 </funcprototype>
37
38 <funcprototype>
39 <funcdef>int <function>sd_bus_is_ready</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_is_open()</function> checks whether the specified bus connection is open, i.e. in the
50 process of being established, already established or in the process of being torn down. It returns zero when the
51 connection has not been started yet
52 (i.e. <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry> or some
53 equivalent call has not been invoked yet), or is fully terminated again (for example after
54 <citerefentry><refentrytitle>sd_bus_close</refentrytitle><manvolnum>3</manvolnum></citerefentry>), it returns
55 positive otherwise.</para>
56
57 <para><function>sd_bus_is_ready()</function> checks whether the specified connection is fully established,
58 i.e. completed the connection and authentication phases of the protocol and received the
59 <function>Hello()</function> method call response, and is not in the process of being torn down again. It returns
60 zero outside of this state, and positive otherwise. Effectively, this function returns positive while regular
61 messages can be sent or received on the connection.</para>
62
63 <para>To be notified when the connection is fully established, use
64 <citerefentry><refentrytitle>sd_bus_set_connected_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry> and
65 install a match for the <function>Connected()</function> signal on the
66 <literal>org.freedesktop.DBus.Local</literal> interface. To be notified when the connection is torn down again,
67 install a match for the <function>Disconnected()</function> signal on the
68 <literal>org.freedesktop.DBus.Local</literal> interface.</para>
69 </refsect1>
70
71 <refsect1>
72 <title>Return Value</title>
73
74 <para>On success, these functions return 0 or a positive integer. On failure, they return a negative errno-style
75 error code.</para>
76 </refsect1>
77
78 <refsect1>
79 <title>Errors</title>
80
81 <para>Returned errors may indicate the following problems:</para>
82
83 <variablelist>
84 <varlistentry>
85 <term><constant>-ECHILD</constant></term>
86
87 <listitem><para>The bus connection has been created in a different process.</para></listitem>
88 </varlistentry>
89 </variablelist>
90 </refsect1>
91
92 <xi:include href="libsystemd-pkgconfig.xml" />
93
94 <refsect1>
95 <title>See Also</title>
96
97 <para>
98 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
99 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
100 <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
101 <citerefentry><refentrytitle>sd_bus_close</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
102 <citerefentry><refentrytitle>sd_bus_set_connected_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>
103 </para>
104 </refsect1>
105
106 </refentry>