]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/sd_bus_set_exit_on_disconnect.xml
man: use <simplelist> for 'See also' sections
[thirdparty/systemd.git] / man / sd_bus_set_exit_on_disconnect.xml
CommitLineData
c72d0fb1
DDM
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">
db9ecf05 4<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
c72d0fb1
DDM
5
6<refentry id="sd_bus_set_exit_on_disconnect"
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8
9 <refentryinfo>
10 <title>sd_bus_set_exit_on_disconnect</title>
11 <productname>systemd</productname>
12 </refentryinfo>
13
14 <refmeta>
15 <refentrytitle>sd_bus_set_exit_on_disconnect</refentrytitle>
16 <manvolnum>3</manvolnum>
17 </refmeta>
18
19 <refnamediv>
20 <refname>sd_bus_set_exit_on_disconnect</refname>
21 <refname>sd_bus_get_exit_on_disconnect</refname>
22
23 <refpurpose>Control the exit behavior when the bus object disconnects</refpurpose>
24 </refnamediv>
25
26 <refsynopsisdiv>
27 <funcsynopsis>
28 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
29
30 <funcprototype>
31 <funcdef>int <function>sd_bus_set_exit_on_disconnect</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_exit_on_disconnect</function></funcdef>
38 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
39 </funcprototype>
40 </funcsynopsis>
41 </refsynopsisdiv>
42
43 <refsect1>
44 <title>Description</title>
45
46 <para><function>sd_bus_set_exit_on_disconnect()</function> may be used to configure the exit
47 behavior when the given bus object disconnects. If <parameter>b</parameter> is zero, no special
48 logic is executed when the bus object disconnects. If <parameter>b</parameter> is non-zero, the
49 behavior on disconnect depends on whether the bus object is attached to an event loop or not. If
50 the bus object is attached to an event loop (see
51 <citerefentry><refentrytitle>sd_bus_attach_event</refentrytitle><manvolnum>3</manvolnum></citerefentry>),
52 the event loop is closed when the bus object disconnects (as if calling
53 <citerefentry><refentrytitle>sd_event_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>).
54 Otherwise,
55 <citerefentry project='man-pages'><refentrytitle>exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>
56 is called. The exit code passed to <function>sd_event_exit()</function> and
57 <function>exit()</function> is <constant>EXIT_FAILURE</constant>. If the bus object has already
58 disconnected when enabling the exit behavior, the exit behavior is executed immediately. By
59 default, the exit behavior is disabled.</para>
60
61 <para><function>sd_bus_get_exit_on_disconnect()</function> returns whether the exit on
62 disconnect behavior is enabled for the given bus object.</para>
63 </refsect1>
64
65 <refsect1>
66 <title>Return Value</title>
67
23139f89 68 <para>On success, <function>sd_bus_set_exit_on_disconnect()</function> returns a non-negative
c72d0fb1
DDM
69 integer. On failure, it returns a negative errno-style error code.</para>
70
23139f89
DDM
71 <para><function>sd_bus_get_exit_on_disconnect()</function> returns a positive integer if the
72 exit on disconnect behavior is enabled. Otherwise, it returns zero.</para>
c72d0fb1
DDM
73
74 <refsect2>
75 <title>Errors</title>
76
77 <para>Returned errors may indicate the following problems:</para>
78
79 <variablelist>
23139f89
DDM
80 <varlistentry>
81 <term><constant>-EINVAL</constant></term>
82
ec07c3c8
AK
83 <listitem><para>A required parameter was <constant>NULL</constant>.</para>
84
85 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
23139f89
DDM
86 </varlistentry>
87
88 <varlistentry>
89 <term><constant>-ENOPKG</constant></term>
90
ec07c3c8
AK
91 <listitem><para>The bus object could not be resolved.</para>
92
93 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
23139f89
DDM
94 </varlistentry>
95
c72d0fb1
DDM
96 <varlistentry>
97 <term><constant>-ECHILD</constant></term>
98
ec07c3c8
AK
99 <listitem><para>The bus connection was created in a different process, library or module instance.</para>
100
101 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
c72d0fb1
DDM
102 </varlistentry>
103 </variablelist>
104 </refsect2>
105 </refsect1>
106
107 <xi:include href="libsystemd-pkgconfig.xml" />
108
69106f47
AK
109 <refsect1>
110 <title>History</title>
00f95506
AK
111 <para><function>sd_bus_set_exit_on_disconnect()</function> and
112 <function>sd_bus_get_exit_on_disconnect()</function> were added in version 246.</para>
69106f47
AK
113 </refsect1>
114
c72d0fb1
DDM
115 <refsect1>
116 <title>See Also</title>
117
13a69c12
DT
118 <para><simplelist type="inline">
119 <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
120 <member><citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
121 <member><citerefentry><refentrytitle>sd_bus_attach_event</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
122 <member><citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
123 <member><citerefentry><refentrytitle>sd_event_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
124 </simplelist></para>
c72d0fb1
DDM
125 </refsect1>
126</refentry>