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