]>
Commit | Line | Data |
---|---|---|
514094f9 | 1 | <?xml version='1.0'?> |
3a54a157 ZJS |
2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> | |
0307f791 | 4 | <!-- SPDX-License-Identifier: LGPL-2.1+ --> |
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 | ||
23 | <refpurpose>Check whether the a bus connection is open or ready.</refpurpose> | |
24 | </refnamediv> | |
25 | ||
26 | <refsynopsisdiv> | |
27 | <funcsynopsis> | |
28 | <funcsynopsisinfo>#include <systemd/sd-bus.h></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 | ||
60 | <para>To be notified when the connection is fully established, use | |
61 | <citerefentry><refentrytitle>sd_bus_set_connected_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry> and | |
62 | install a match for the <function>Connected()</function> signal on the | |
63 | <literal>org.freedesktop.DBus.Local</literal> interface. To be notified when the connection is torn down again, | |
64 | install a match for the <function>Disconnected()</function> signal on the | |
65 | <literal>org.freedesktop.DBus.Local</literal> interface.</para> | |
66 | </refsect1> | |
67 | ||
68 | <refsect1> | |
69 | <title>Return Value</title> | |
70 | ||
71 | <para>On success, these functions return 0 or a positive integer. On failure, they return a negative errno-style | |
72 | error code.</para> | |
d97eac36 | 73 | |
b1de39de ZJS |
74 | <refsect2> |
75 | <title>Errors</title> | |
d97eac36 | 76 | |
b1de39de | 77 | <para>Returned errors may indicate the following problems:</para> |
d97eac36 | 78 | |
b1de39de ZJS |
79 | <variablelist> |
80 | <varlistentry> | |
81 | <term><constant>-ECHILD</constant></term> | |
d97eac36 | 82 | |
b1de39de ZJS |
83 | <listitem><para>The bus connection has been created in a different process.</para></listitem> |
84 | </varlistentry> | |
85 | </variablelist> | |
86 | </refsect2> | |
d97eac36 LP |
87 | </refsect1> |
88 | ||
7647c01d | 89 | <xi:include href="libsystemd-pkgconfig.xml" /> |
d97eac36 LP |
90 | |
91 | <refsect1> | |
92 | <title>See Also</title> | |
93 | ||
94 | <para> | |
95 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
96 | <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
97 | <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
98 | <citerefentry><refentrytitle>sd_bus_close</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
99 | <citerefentry><refentrytitle>sd_bus_set_connected_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
100 | </para> | |
101 | </refsect1> | |
102 | ||
103 | </refentry> |