]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/sd_bus_is_open.xml
Merge pull request #32326 from jonathan-conder/man_pam_loadkey
[thirdparty/systemd.git] / man / sd_bus_is_open.xml
CommitLineData
514094f9 1<?xml version='1.0'?>
3a54a157 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
eea10b26 3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
db9ecf05 4<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
d97eac36 5
7647c01d
LP
6<refentry id="sd_bus_is_open"
7 xmlns:xi="http://www.w3.org/2001/XInclude">
d97eac36
LP
8
9 <refentryinfo>
10 <title>sd_bus_is_open</title>
11 <productname>systemd</productname>
d97eac36
LP
12 </refentryinfo>
13
14 <refmeta>
15 <refentrytitle>sd_bus_is_open</refentrytitle>
16 <manvolnum>3</manvolnum>
17 </refmeta>
18
19 <refnamediv>
20 <refname>sd_bus_is_open</refname>
21 <refname>sd_bus_is_ready</refname>
22
e9dd6984 23 <refpurpose>Check whether the bus connection is open or ready</refpurpose>
d97eac36
LP
24 </refnamediv>
25
26 <refsynopsisdiv>
27 <funcsynopsis>
28 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
29
30 <funcprototype>
31 <funcdef>int <function>sd_bus_is_open</function></funcdef>
32 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
33 </funcprototype>
34
35 <funcprototype>
36 <funcdef>int <function>sd_bus_is_ready</function></funcdef>
37 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
38 </funcprototype>
39
40 </funcsynopsis>
41 </refsynopsisdiv>
42
43 <refsect1>
44 <title>Description</title>
45
46 <para><function>sd_bus_is_open()</function> checks whether the specified bus connection is open, i.e. in the
47 process of being established, already established or in the process of being torn down. It returns zero when the
48 connection has not been started yet
49 (i.e. <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry> or some
50 equivalent call has not been invoked yet), or is fully terminated again (for example after
51 <citerefentry><refentrytitle>sd_bus_close</refentrytitle><manvolnum>3</manvolnum></citerefentry>), it returns
52 positive otherwise.</para>
53
54 <para><function>sd_bus_is_ready()</function> checks whether the specified connection is fully established,
55 i.e. completed the connection and authentication phases of the protocol and received the
56 <function>Hello()</function> method call response, and is not in the process of being torn down again. It returns
57 zero outside of this state, and positive otherwise. Effectively, this function returns positive while regular
58 messages can be sent or received on the connection.</para>
59
3bbb76f6
ZJS
60 <para>The <parameter>bus</parameter> argument may be <constant>NULL</constant>, zero is also returned in
61 that case.</para>
62
d97eac36
LP
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
3bbb76f6
ZJS
74 <para>Those functions return 0 if the bus is <emphasis>not</emphasis> in the given state, and a positive
75 integer when it is. On failure, a negative errno-style error code is returned.</para>
d97eac36 76
b1de39de
ZJS
77 <refsect2>
78 <title>Errors</title>
d97eac36 79
b1de39de 80 <para>Returned errors may indicate the following problems:</para>
d97eac36 81
b1de39de
ZJS
82 <variablelist>
83 <varlistentry>
84 <term><constant>-ECHILD</constant></term>
d97eac36 85
bf876e3f 86 <listitem><para>The bus connection has been created in a different process, library or module instance.</para></listitem>
b1de39de
ZJS
87 </varlistentry>
88 </variablelist>
89 </refsect2>
d97eac36
LP
90 </refsect1>
91
7647c01d 92 <xi:include href="libsystemd-pkgconfig.xml" />
d97eac36 93
69106f47
AK
94 <refsect1>
95 <title>History</title>
87fe0a69
YW
96 <para><function>sd_bus_is_open()</function> was added in version 221.</para>
97 <para><function>sd_bus_is_ready()</function> was added in version 237.</para>
69106f47
AK
98 </refsect1>
99
d97eac36
LP
100 <refsect1>
101 <title>See Also</title>
102
13a69c12
DT
103 <para><simplelist type="inline">
104 <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
105 <member><citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
106 <member><citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
107 <member><citerefentry><refentrytitle>sd_bus_close</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
108 <member><citerefentry><refentrytitle>sd_bus_set_connected_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
109 </simplelist></para>
d97eac36
LP
110 </refsect1>
111
112</refentry>