]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/sd_bus_set_connected_signal.xml
verify: use manager_load_startable_unit_or_warn() to load units for verification
[thirdparty/systemd.git] / man / sd_bus_set_connected_signal.xml
CommitLineData
d97eac36
LP
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 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.
16
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.
21
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/>.
24-->
25
26<refentry id="sd_bus_set_connected_signal">
27
28 <refentryinfo>
29 <title>sd_bus_set_connected_signal</title>
30 <productname>systemd</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_set_connected_signal</refentrytitle>
44 <manvolnum>3</manvolnum>
45 </refmeta>
46
47 <refnamediv>
48 <refname>sd_bus_set_connected_signal</refname>
49 <refname>sd_bus_get_connected_signal</refname>
50
51 <refpurpose>Control emmission of local connection establishment signal on bus connections</refpurpose>
52 </refnamediv>
53
54 <refsynopsisdiv>
55 <funcsynopsis>
56 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
57
58 <funcprototype>
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>
62 </funcprototype>
63
64 <funcprototype>
65 <funcdef>int <function>sd_bus_get_connected_signal</function></funcdef>
66 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
67 </funcprototype>
68
69 </funcsynopsis>
70 </refsynopsisdiv>
71
72 <refsect1>
73 <title>Description</title>
74
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>
79
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>
82
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>
88
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>
95
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>
100 </refsect1>
101
102 <refsect1>
103 <title>Return Value</title>
104
105 <para>On success, these functions return 0 or a positive integer. On failure, they return a negative errno-style
106 error code.</para>
107 </refsect1>
108
109 <refsect1>
110 <title>Errors</title>
111
112 <para>Returned errors may indicate the following problems:</para>
113
114 <variablelist>
115 <varlistentry>
116 <term><constant>-ECHILD</constant></term>
117
118 <listitem><para>The bus connection has been created in a different process.</para></listitem>
119 </varlistentry>
120 </variablelist>
121 </refsect1>
122
123 <refsect1>
124 <title>Notes</title>
125
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>
129 </refsect1>
130
131 <refsect1>
132 <title>See Also</title>
133
134 <para>
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>
140 </para>
141 </refsect1>
142
143</refentry>