]>
Commit | Line | Data |
---|---|---|
514094f9 | 1 | <?xml version='1.0'?> |
d97eac36 LP |
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+ | |
d97eac36 LP |
7 | --> |
8 | ||
9 | <refentry id="sd_bus_set_connected_signal"> | |
10 | ||
11 | <refentryinfo> | |
12 | <title>sd_bus_set_connected_signal</title> | |
13 | <productname>systemd</productname> | |
d97eac36 LP |
14 | </refentryinfo> |
15 | ||
16 | <refmeta> | |
17 | <refentrytitle>sd_bus_set_connected_signal</refentrytitle> | |
18 | <manvolnum>3</manvolnum> | |
19 | </refmeta> | |
20 | ||
21 | <refnamediv> | |
22 | <refname>sd_bus_set_connected_signal</refname> | |
23 | <refname>sd_bus_get_connected_signal</refname> | |
24 | ||
25 | <refpurpose>Control emmission of local connection establishment signal on bus connections</refpurpose> | |
26 | </refnamediv> | |
27 | ||
28 | <refsynopsisdiv> | |
29 | <funcsynopsis> | |
30 | <funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo> | |
31 | ||
32 | <funcprototype> | |
33 | <funcdef>int <function>sd_bus_set_connected_signal</function></funcdef> | |
34 | <paramdef>sd_bus *<parameter>bus</parameter></paramdef> | |
35 | <paramdef>int <parameter>b</parameter></paramdef> | |
36 | </funcprototype> | |
37 | ||
38 | <funcprototype> | |
39 | <funcdef>int <function>sd_bus_get_connected_signal</function></funcdef> | |
40 | <paramdef>sd_bus *<parameter>bus</parameter></paramdef> | |
41 | </funcprototype> | |
42 | ||
43 | </funcsynopsis> | |
44 | </refsynopsisdiv> | |
45 | ||
46 | <refsect1> | |
47 | <title>Description</title> | |
48 | ||
49 | <para><function>sd_bus_set_connected_signal()</function> may be used to control whether a local, synthetic | |
50 | <function>Connected()</function> signal message shall be generated and enqueued for dispatching when the connection | |
51 | is fully established. If the <parameter>b</parameter> parameter is zero the message is not generated (the default), | |
52 | otherwise it is generated.</para> | |
53 | ||
54 | <para><function>sd_bus_get_connected_signal()</function> may be used to query whether this feature is enabled. It | |
55 | returns zero if not, positive otherwise.</para> | |
56 | ||
57 | <para>The <function>Connected()</function> signal message is generated from the | |
58 | <literal>org.freedesktop.DBus.Local</literal> service and interface, and | |
59 | <literal>/org/freedesktop/DBus/Local</literal> object path. Use | |
60 | <citerefentry><refentrytitle>sd_bus_match_signal_async</refentrytitle><manvolnum>3</manvolnum></citerefentry> to | |
61 | match on this signal.</para> | |
62 | ||
63 | <para>This message is particularly useful on slow transports where connections take a long time to be | |
64 | established. This is especially the case when | |
65 | <citerefentry><refentrytitle>sd_bus_set_watch_bind</refentrytitle><manvolnum>3</manvolnum></citerefentry> is | |
66 | used. The signal is generated when the | |
67 | <citerefentry><refentrytitle>sd_bus_is_ready</refentrytitle><manvolnum>3</manvolnum></citerefentry> returns | |
68 | positive for the first time.</para> | |
69 | ||
70 | <para>The <function>Connected()</function> signal corresponds with the <function>Disconnected()</function> signal | |
71 | that is synthesized locally when the connection is terminated. The latter is generated unconditionally however, | |
72 | unlike the former which needs to be enabled explicitly before it is generated, with | |
73 | <function>sd_bus_set_connected_signal()</function>.</para> | |
74 | </refsect1> | |
75 | ||
76 | <refsect1> | |
77 | <title>Return Value</title> | |
78 | ||
79 | <para>On success, these functions return 0 or a positive integer. On failure, they return a negative errno-style | |
80 | error code.</para> | |
81 | </refsect1> | |
82 | ||
83 | <refsect1> | |
84 | <title>Errors</title> | |
85 | ||
86 | <para>Returned errors may indicate the following problems:</para> | |
87 | ||
88 | <variablelist> | |
89 | <varlistentry> | |
90 | <term><constant>-ECHILD</constant></term> | |
91 | ||
92 | <listitem><para>The bus connection has been created in a different process.</para></listitem> | |
93 | </varlistentry> | |
94 | </variablelist> | |
95 | </refsect1> | |
96 | ||
97 | <refsect1> | |
98 | <title>Notes</title> | |
99 | ||
100 | <para><function>sd_bus_set_connected_signal()</function> and <function>sd_bus_get_connected_signal()</function> are available as | |
101 | a shared library, which can be compiled and linked to with the <constant>libsystemd</constant> <citerefentry | |
102 | project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> file.</para> | |
103 | </refsect1> | |
104 | ||
105 | <refsect1> | |
106 | <title>See Also</title> | |
107 | ||
108 | <para> | |
109 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
110 | <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
111 | <citerefentry><refentrytitle>sd_bus_match_signal_async</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
112 | <citerefentry><refentrytitle>sd_bus_set_watch_bind</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
113 | <citerefentry><refentrytitle>sd_bus_is_ready</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
114 | </para> | |
115 | </refsect1> | |
116 | ||
117 | </refentry> |