chiark / gitweb /
man: add missing headers to glib-event-glue.c
[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   This file is part of elogind.
9
10   Copyright 2017 Lennart Poettering
11
12   elogind is free software; you can redistribute it and/or modify it
13   under the terms of the GNU Lesser General Public License as published by
14   the Free Software Foundation; either version 2.1 of the License, or
15   (at your option) any later version.
16
17   elogind is distributed in the hope that it will be useful, but
18   WITHOUT ANY WARRANTY; without even the implied warranty of
19   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20   Lesser General Public License for more details.
21
22   You should have received a copy of the GNU Lesser General Public License
23   along with elogind; If not, see <http://www.gnu.org/licenses/>.
24 -->
25
26 <refentry id="sd_bus_is_open">
27
28   <refentryinfo>
29     <title>sd_bus_is_open</title>
30     <productname>elogind</productname>
31
32     <authorgroup>
33       <author>
34         <contrib>Developer</contrib>
35         <firstname>Lennart</firstname>
36         <surname>Poettering</surname>
37         <email>lennart@poettering.net</email>
38       </author>
39     </authorgroup>
40   </refentryinfo>
41
42   <refmeta>
43     <refentrytitle>sd_bus_is_open</refentrytitle>
44     <manvolnum>3</manvolnum>
45   </refmeta>
46
47   <refnamediv>
48     <refname>sd_bus_is_open</refname>
49     <refname>sd_bus_is_ready</refname>
50
51     <refpurpose>Check whether the a bus connection is open or ready.</refpurpose>
52   </refnamediv>
53
54   <refsynopsisdiv>
55     <funcsynopsis>
56       <funcsynopsisinfo>#include &lt;elogind/sd-bus.h&gt;</funcsynopsisinfo>
57
58       <funcprototype>
59         <funcdef>int <function>sd_bus_is_open</function></funcdef>
60         <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
61       </funcprototype>
62
63       <funcprototype>
64         <funcdef>int <function>sd_bus_is_ready</function></funcdef>
65         <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
66       </funcprototype>
67
68     </funcsynopsis>
69   </refsynopsisdiv>
70
71   <refsect1>
72     <title>Description</title>
73
74     <para><function>sd_bus_is_open()</function> checks whether the specified bus connection is open, i.e. in the
75     process of being established, already established or in the process of being torn down. It returns zero when the
76     connection has not been started yet
77     (i.e. <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry> or some
78     equivalent call has not been invoked yet), or is fully terminated again (for example after
79     <citerefentry><refentrytitle>sd_bus_close</refentrytitle><manvolnum>3</manvolnum></citerefentry>), it returns
80     positive otherwise.</para>
81
82     <para><function>sd_bus_is_ready()</function> checks whether the specified connection is fully established,
83     i.e. completed the connection and authentication phases of the protocol and received the
84     <function>Hello()</function> method call response, and is not in the process of being torn down again. It returns
85     zero outside of this state, and positive otherwise. Effectively, this function returns positive while regular
86     messages can be sent or received on the connection.</para>
87
88     <para>To be notified when the connection is fully established, use
89     <citerefentry><refentrytitle>sd_bus_set_connected_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry> and
90     install a match for the <function>Connected()</function> signal on the
91     <literal>org.freedesktop.DBus.Local</literal> interface. To be notified when the connection is torn down again,
92     install a match for the <function>Disconnected()</function> signal on the
93     <literal>org.freedesktop.DBus.Local</literal> interface.</para>
94   </refsect1>
95
96   <refsect1>
97     <title>Return Value</title>
98
99     <para>On success, these functions return 0 or a positive integer. On failure, they return a negative errno-style
100     error code.</para>
101   </refsect1>
102
103   <refsect1>
104     <title>Errors</title>
105
106     <para>Returned errors may indicate the following problems:</para>
107
108     <variablelist>
109       <varlistentry>
110         <term><constant>-ECHILD</constant></term>
111
112         <listitem><para>The bus connection has been created in a different process.</para></listitem>
113       </varlistentry>
114     </variablelist>
115   </refsect1>
116
117   <refsect1>
118     <title>Notes</title>
119
120     <para><function>sd_bus_is_open()</function> and <function>sd_bus_is_ready()</function> are available as
121     a shared library, which can be compiled and linked to with the <constant>libelogind</constant> <citerefentry
122     project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> file.</para>
123   </refsect1>
124
125   <refsect1>
126     <title>See Also</title>
127
128     <para>
129       <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
130       <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
131       <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
132       <citerefentry><refentrytitle>sd_bus_close</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
133       <citerefentry><refentrytitle>sd_bus_set_connected_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>
134     </para>
135   </refsect1>
136
137 </refentry>