| 1 |
<?xml version='1.0'?> |
| 2 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 3 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
| 4 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 5 |
|
| 6 |
<refentry id="sd_bus_is_open" |
| 7 |
xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 8 |
|
| 9 |
<refentryinfo> |
| 10 |
<title>sd_bus_is_open</title> |
| 11 |
<productname>systemd</productname> |
| 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 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>The <parameter>bus</parameter> argument may be <constant>NULL</constant>, zero is also returned in |
| 61 |
that case.</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>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> |
| 76 |
|
| 77 |
<refsect2> |
| 78 |
<title>Errors</title> |
| 79 |
|
| 80 |
<para>Returned errors may indicate the following problems:</para> |
| 81 |
|
| 82 |
<variablelist> |
| 83 |
<varlistentry> |
| 84 |
<term><constant>-ECHILD</constant></term> |
| 85 |
|
| 86 |
<listitem><para>The bus connection has been created in a different process, library or module instance.</para></listitem> |
| 87 |
</varlistentry> |
| 88 |
</variablelist> |
| 89 |
</refsect2> |
| 90 |
</refsect1> |
| 91 |
|
| 92 |
<xi:include href="libsystemd-pkgconfig.xml" /> |
| 93 |
|
| 94 |
<refsect1> |
| 95 |
<title>History</title> |
| 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> |
| 98 |
</refsect1> |
| 99 |
|
| 100 |
<refsect1> |
| 101 |
<title>See Also</title> |
| 102 |
|
| 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> |
| 110 |
</refsect1> |
| 111 |
|
| 112 |
</refentry> |