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