]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_bus_is_open.xml
tree-wide: drop license boilerplate
[thirdparty/systemd.git] / man / sd_bus_is_open.xml
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 This file is part of systemd.
9
10 Copyright 2017 Lennart Poettering
11 -->
12
13 <refentry id="sd_bus_is_open">
14
15 <refentryinfo>
16 <title>sd_bus_is_open</title>
17 <productname>systemd</productname>
18
19 <authorgroup>
20 <author>
21 <contrib>Developer</contrib>
22 <firstname>Lennart</firstname>
23 <surname>Poettering</surname>
24 <email>lennart@poettering.net</email>
25 </author>
26 </authorgroup>
27 </refentryinfo>
28
29 <refmeta>
30 <refentrytitle>sd_bus_is_open</refentrytitle>
31 <manvolnum>3</manvolnum>
32 </refmeta>
33
34 <refnamediv>
35 <refname>sd_bus_is_open</refname>
36 <refname>sd_bus_is_ready</refname>
37
38 <refpurpose>Check whether the a bus connection is open or ready.</refpurpose>
39 </refnamediv>
40
41 <refsynopsisdiv>
42 <funcsynopsis>
43 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
44
45 <funcprototype>
46 <funcdef>int <function>sd_bus_is_open</function></funcdef>
47 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
48 </funcprototype>
49
50 <funcprototype>
51 <funcdef>int <function>sd_bus_is_ready</function></funcdef>
52 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
53 </funcprototype>
54
55 </funcsynopsis>
56 </refsynopsisdiv>
57
58 <refsect1>
59 <title>Description</title>
60
61 <para><function>sd_bus_is_open()</function> checks whether the specified bus connection is open, i.e. in the
62 process of being established, already established or in the process of being torn down. It returns zero when the
63 connection has not been started yet
64 (i.e. <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry> or some
65 equivalent call has not been invoked yet), or is fully terminated again (for example after
66 <citerefentry><refentrytitle>sd_bus_close</refentrytitle><manvolnum>3</manvolnum></citerefentry>), it returns
67 positive otherwise.</para>
68
69 <para><function>sd_bus_is_ready()</function> checks whether the specified connection is fully established,
70 i.e. completed the connection and authentication phases of the protocol and received the
71 <function>Hello()</function> method call response, and is not in the process of being torn down again. It returns
72 zero outside of this state, and positive otherwise. Effectively, this function returns positive while regular
73 messages can be sent or received on the connection.</para>
74
75 <para>To be notified when the connection is fully established, use
76 <citerefentry><refentrytitle>sd_bus_set_connected_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry> and
77 install a match for the <function>Connected()</function> signal on the
78 <literal>org.freedesktop.DBus.Local</literal> interface. To be notified when the connection is torn down again,
79 install a match for the <function>Disconnected()</function> signal on the
80 <literal>org.freedesktop.DBus.Local</literal> interface.</para>
81 </refsect1>
82
83 <refsect1>
84 <title>Return Value</title>
85
86 <para>On success, these functions return 0 or a positive integer. On failure, they return a negative errno-style
87 error code.</para>
88 </refsect1>
89
90 <refsect1>
91 <title>Errors</title>
92
93 <para>Returned errors may indicate the following problems:</para>
94
95 <variablelist>
96 <varlistentry>
97 <term><constant>-ECHILD</constant></term>
98
99 <listitem><para>The bus connection has been created in a different process.</para></listitem>
100 </varlistentry>
101 </variablelist>
102 </refsect1>
103
104 <refsect1>
105 <title>Notes</title>
106
107 <para><function>sd_bus_is_open()</function> and <function>sd_bus_is_ready()</function> are available as
108 a shared library, which can be compiled and linked to with the <constant>libsystemd</constant> <citerefentry
109 project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> file.</para>
110 </refsect1>
111
112 <refsect1>
113 <title>See Also</title>
114
115 <para>
116 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
117 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
118 <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
119 <citerefentry><refentrytitle>sd_bus_close</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
120 <citerefentry><refentrytitle>sd_bus_set_connected_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>
121 </para>
122 </refsect1>
123
124 </refentry>