]>
Commit | Line | Data |
---|---|---|
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 | ||
9 | <refentry id="sd_bus_is_open"> | |
10 | ||
11 | <refentryinfo> | |
12 | <title>sd_bus_is_open</title> | |
13 | <productname>systemd</productname> | |
14 | </refentryinfo> | |
15 | ||
16 | <refmeta> | |
17 | <refentrytitle>sd_bus_is_open</refentrytitle> | |
18 | <manvolnum>3</manvolnum> | |
19 | </refmeta> | |
20 | ||
21 | <refnamediv> | |
22 | <refname>sd_bus_is_open</refname> | |
23 | <refname>sd_bus_is_ready</refname> | |
24 | ||
25 | <refpurpose>Check whether the a bus connection is open or ready.</refpurpose> | |
26 | </refnamediv> | |
27 | ||
28 | <refsynopsisdiv> | |
29 | <funcsynopsis> | |
30 | <funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo> | |
31 | ||
32 | <funcprototype> | |
33 | <funcdef>int <function>sd_bus_is_open</function></funcdef> | |
34 | <paramdef>sd_bus *<parameter>bus</parameter></paramdef> | |
35 | </funcprototype> | |
36 | ||
37 | <funcprototype> | |
38 | <funcdef>int <function>sd_bus_is_ready</function></funcdef> | |
39 | <paramdef>sd_bus *<parameter>bus</parameter></paramdef> | |
40 | </funcprototype> | |
41 | ||
42 | </funcsynopsis> | |
43 | </refsynopsisdiv> | |
44 | ||
45 | <refsect1> | |
46 | <title>Description</title> | |
47 | ||
48 | <para><function>sd_bus_is_open()</function> checks whether the specified bus connection is open, i.e. in the | |
49 | process of being established, already established or in the process of being torn down. It returns zero when the | |
50 | connection has not been started yet | |
51 | (i.e. <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry> or some | |
52 | equivalent call has not been invoked yet), or is fully terminated again (for example after | |
53 | <citerefentry><refentrytitle>sd_bus_close</refentrytitle><manvolnum>3</manvolnum></citerefentry>), it returns | |
54 | positive otherwise.</para> | |
55 | ||
56 | <para><function>sd_bus_is_ready()</function> checks whether the specified connection is fully established, | |
57 | i.e. completed the connection and authentication phases of the protocol and received the | |
58 | <function>Hello()</function> method call response, and is not in the process of being torn down again. It returns | |
59 | zero outside of this state, and positive otherwise. Effectively, this function returns positive while regular | |
60 | messages can be sent or received on the connection.</para> | |
61 | ||
62 | <para>To be notified when the connection is fully established, use | |
63 | <citerefentry><refentrytitle>sd_bus_set_connected_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry> and | |
64 | install a match for the <function>Connected()</function> signal on the | |
65 | <literal>org.freedesktop.DBus.Local</literal> interface. To be notified when the connection is torn down again, | |
66 | install a match for the <function>Disconnected()</function> signal on the | |
67 | <literal>org.freedesktop.DBus.Local</literal> interface.</para> | |
68 | </refsect1> | |
69 | ||
70 | <refsect1> | |
71 | <title>Return Value</title> | |
72 | ||
73 | <para>On success, these functions return 0 or a positive integer. On failure, they return a negative errno-style | |
74 | error code.</para> | |
75 | </refsect1> | |
76 | ||
77 | <refsect1> | |
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.</para></listitem> | |
87 | </varlistentry> | |
88 | </variablelist> | |
89 | </refsect1> | |
90 | ||
91 | <refsect1> | |
92 | <title>Notes</title> | |
93 | ||
94 | <para><function>sd_bus_is_open()</function> and <function>sd_bus_is_ready()</function> are available as | |
95 | a shared library, which can be compiled and linked to with the <constant>libsystemd</constant> <citerefentry | |
96 | project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> file.</para> | |
97 | </refsect1> | |
98 | ||
99 | <refsect1> | |
100 | <title>See Also</title> | |
101 | ||
102 | <para> | |
103 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
104 | <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
105 | <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
106 | <citerefentry><refentrytitle>sd_bus_close</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
107 | <citerefentry><refentrytitle>sd_bus_set_connected_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
108 | </para> | |
109 | </refsect1> | |
110 | ||
111 | </refentry> |