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">
6 SPDX-License-Identifier: LGPL-2.1+
8 This file is part of systemd.
10 Copyright 2017 Lennart Poettering
12 systemd 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.
17 systemd 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.
22 You should have received a copy of the GNU Lesser General Public License
23 along with systemd; If not, see <http://www.gnu.org/licenses/>.
26 <refentry id=
"sd_bus_set_connected_signal">
29 <title>sd_bus_set_connected_signal
</title>
30 <productname>systemd
</productname>
34 <contrib>Developer
</contrib>
35 <firstname>Lennart
</firstname>
36 <surname>Poettering
</surname>
37 <email>lennart@poettering.net
</email>
43 <refentrytitle>sd_bus_set_connected_signal
</refentrytitle>
44 <manvolnum>3</manvolnum>
48 <refname>sd_bus_set_connected_signal
</refname>
49 <refname>sd_bus_get_connected_signal
</refname>
51 <refpurpose>Control emmission of local connection establishment signal on bus connections
</refpurpose>
56 <funcsynopsisinfo>#include
<systemd/sd-bus.h
></funcsynopsisinfo>
59 <funcdef>int
<function>sd_bus_set_connected_signal
</function></funcdef>
60 <paramdef>sd_bus *
<parameter>bus
</parameter></paramdef>
61 <paramdef>int
<parameter>b
</parameter></paramdef>
65 <funcdef>int
<function>sd_bus_get_connected_signal
</function></funcdef>
66 <paramdef>sd_bus *
<parameter>bus
</parameter></paramdef>
73 <title>Description
</title>
75 <para><function>sd_bus_set_connected_signal()
</function> may be used to control whether a local, synthetic
76 <function>Connected()
</function> signal message shall be generated and enqueued for dispatching when the connection
77 is fully established. If the
<parameter>b
</parameter> parameter is zero the message is not generated (the default),
78 otherwise it is generated.
</para>
80 <para><function>sd_bus_get_connected_signal()
</function> may be used to query whether this feature is enabled. It
81 returns zero if not, positive otherwise.
</para>
83 <para>The
<function>Connected()
</function> signal message is generated from the
84 <literal>org.freedesktop.DBus.Local
</literal> service and interface, and
85 <literal>/org/freedesktop/DBus/Local
</literal> object path. Use
86 <citerefentry><refentrytitle>sd_bus_match_signal_async
</refentrytitle><manvolnum>3</manvolnum></citerefentry> to
87 match on this signal.
</para>
89 <para>This message is particularly useful on slow transports where connections take a long time to be
90 established. This is especially the case when
91 <citerefentry><refentrytitle>sd_bus_set_watch_bind
</refentrytitle><manvolnum>3</manvolnum></citerefentry> is
92 used. The signal is generated when the
93 <citerefentry><refentrytitle>sd_bus_is_ready
</refentrytitle><manvolnum>3</manvolnum></citerefentry> returns
94 positive for the first time.
</para>
96 <para>The
<function>Connected()
</function> signal corresponds with the
<function>Disconnected()
</function> signal
97 that is synthesized locally when the connection is terminated. The latter is generated unconditionally however,
98 unlike the former which needs to be enabled explicitly before it is generated, with
99 <function>sd_bus_set_connected_signal()
</function>.
</para>
103 <title>Return Value
</title>
105 <para>On success, these functions return
0 or a positive integer. On failure, they return a negative errno-style
110 <title>Errors
</title>
112 <para>Returned errors may indicate the following problems:
</para>
116 <term><constant>-ECHILD
</constant></term>
118 <listitem><para>The bus connection has been created in a different process.
</para></listitem>
126 <para><function>sd_bus_set_connected_signal()
</function> and
<function>sd_bus_get_connected_signal()
</function> are available as
127 a shared library, which can be compiled and linked to with the
<constant>libsystemd
</constant> <citerefentry
128 project='die-net'
><refentrytitle>pkg-config
</refentrytitle><manvolnum>1</manvolnum></citerefentry> file.
</para>
132 <title>See Also
</title>
135 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
136 <citerefentry><refentrytitle>sd-bus
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
137 <citerefentry><refentrytitle>sd_bus_match_signal_async
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
138 <citerefentry><refentrytitle>sd_bus_set_watch_bind
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
139 <citerefentry><refentrytitle>sd_bus_is_ready
</refentrytitle><manvolnum>3</manvolnum></citerefentry>