1<?xml version='1.0'?> 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> 4<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> 5 6<refentry id="sd_bus_set_connected_signal" 7 xmlns:xi="http://www.w3.org/2001/XInclude"> 8 9 <refentryinfo> 10 <title>sd_bus_set_connected_signal</title> 11 <productname>systemd</productname> 12 </refentryinfo> 13 14 <refmeta> 15 <refentrytitle>sd_bus_set_connected_signal</refentrytitle> 16 <manvolnum>3</manvolnum> 17 </refmeta> 18 19 <refnamediv> 20 <refname>sd_bus_set_connected_signal</refname> 21 <refname>sd_bus_get_connected_signal</refname> 22 23 <refpurpose>Control emission of local connection establishment signal on bus connections</refpurpose> 24 </refnamediv> 25 26 <refsynopsisdiv> 27 <funcsynopsis> 28 <funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo> 29 30 <funcprototype> 31 <funcdef>int <function>sd_bus_set_connected_signal</function></funcdef> 32 <paramdef>sd_bus *<parameter>bus</parameter></paramdef> 33 <paramdef>int <parameter>b</parameter></paramdef> 34 </funcprototype> 35 36 <funcprototype> 37 <funcdef>int <function>sd_bus_get_connected_signal</function></funcdef> 38 <paramdef>sd_bus *<parameter>bus</parameter></paramdef> 39 </funcprototype> 40 41 </funcsynopsis> 42 </refsynopsisdiv> 43 44 <refsect1> 45 <title>Description</title> 46 47 <para><function>sd_bus_set_connected_signal()</function> may be used to control whether a local, synthetic 48 <function>Connected()</function> signal message shall be generated and enqueued for dispatching when the connection 49 is fully established. If the <parameter>b</parameter> parameter is zero the message is not generated (the default), 50 otherwise it is generated.</para> 51 52 <para><function>sd_bus_get_connected_signal()</function> may be used to query whether this feature is enabled. It 53 returns zero if not, positive otherwise.</para> 54 55 <para>The <function>Connected()</function> signal message is generated from the 56 <literal>org.freedesktop.DBus.Local</literal> service and interface, and 57 <literal>/org/freedesktop/DBus/Local</literal> object path. Use 58 <citerefentry><refentrytitle>sd_bus_match_signal_async</refentrytitle><manvolnum>3</manvolnum></citerefentry> to 59 match on this signal.</para> 60 61 <para>This message is particularly useful on slow transports where connections take a long time to be 62 established. This is especially the case when 63 <citerefentry><refentrytitle>sd_bus_set_watch_bind</refentrytitle><manvolnum>3</manvolnum></citerefentry> is 64 used. The signal is generated when the 65 <citerefentry><refentrytitle>sd_bus_is_ready</refentrytitle><manvolnum>3</manvolnum></citerefentry> returns 66 positive for the first time.</para> 67 68 <para>The <function>Connected()</function> signal corresponds with the <function>Disconnected()</function> signal 69 that is synthesized locally when the connection is terminated. The latter is generated unconditionally however, 70 unlike the former which needs to be enabled explicitly before it is generated, with 71 <function>sd_bus_set_connected_signal()</function>.</para> 72 </refsect1> 73 74 <refsect1> 75 <title>Return Value</title> 76 77 <para>On success, these functions return 0 or a positive integer. On failure, they return a negative 78 errno-style error code.</para> 79 80 <refsect2> 81 <title>Errors</title> 82 83 <para>Returned errors may indicate the following problems:</para> 84 85 <variablelist> 86 <varlistentry> 87 <term><constant>-ECHILD</constant></term> 88 89 <listitem><para>The bus connection has been created in a different process.</para></listitem> 90 </varlistentry> 91 </variablelist> 92 </refsect2> 93 </refsect1> 94 95 <xi:include href="libsystemd-pkgconfig.xml" /> 96 97 <refsect1> 98 <title>See Also</title> 99 100 <para> 101 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, 102 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>, 103 <citerefentry><refentrytitle>sd_bus_match_signal_async</refentrytitle><manvolnum>3</manvolnum></citerefentry>, 104 <citerefentry><refentrytitle>sd_bus_set_watch_bind</refentrytitle><manvolnum>3</manvolnum></citerefentry>, 105 <citerefentry><refentrytitle>sd_bus_is_ready</refentrytitle><manvolnum>3</manvolnum></citerefentry> 106 </para> 107 </refsect1> 108 109</refentry> 110