]>
Commit | Line | Data |
---|---|---|
c4e48030 | 1 | <?xml version='1.0'?> |
3a54a157 ZJS |
2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> | |
0307f791 | 4 | <!-- SPDX-License-Identifier: LGPL-2.1+ --> |
c4e48030 LP |
5 | |
6 | <refentry id="sd_bus_set_close_on_exit" | |
7 | xmlns:xi="http://www.w3.org/2001/XInclude"> | |
8 | ||
9 | <refentryinfo> | |
10 | <title>sd_bus_set_close_on_exit</title> | |
11 | <productname>systemd</productname> | |
12 | </refentryinfo> | |
13 | ||
14 | <refmeta> | |
15 | <refentrytitle>sd_bus_set_close_on_exit</refentrytitle> | |
16 | <manvolnum>3</manvolnum> | |
17 | </refmeta> | |
18 | ||
19 | <refnamediv> | |
20 | <refname>sd_bus_set_close_on_exit</refname> | |
21 | <refname>sd_bus_get_close_on_exit</refname> | |
22 | ||
23139f89 DDM |
23 | <refpurpose>Control whether to close the bus connection during the event loop exit phase |
24 | </refpurpose> | |
c4e48030 LP |
25 | </refnamediv> |
26 | ||
27 | <refsynopsisdiv> | |
28 | <funcsynopsis> | |
29 | <funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo> | |
30 | ||
31 | <funcprototype> | |
32 | <funcdef>int <function>sd_bus_set_close_on_exit</function></funcdef> | |
33 | <paramdef>sd_bus *<parameter>bus</parameter></paramdef> | |
34 | <paramdef>int <parameter>b</parameter></paramdef> | |
35 | </funcprototype> | |
36 | ||
37 | <funcprototype> | |
38 | <funcdef>int <function>sd_bus_get_close_on_exit</function></funcdef> | |
39 | <paramdef>sd_bus *<parameter>bus</parameter></paramdef> | |
40 | </funcprototype> | |
41 | ||
42 | </funcsynopsis> | |
43 | </refsynopsisdiv> | |
44 | ||
45 | <refsect1> | |
46 | <title>Description</title> | |
47 | ||
23139f89 DDM |
48 | <para><function>sd_bus_set_close_on_exit()</function> may be used to enable or disable whether |
49 | the bus connection is automatically flushed (as in | |
50 | <citerefentry><refentrytitle>sd_bus_flush</refentrytitle><manvolnum>3</manvolnum></citerefentry>) | |
51 | and closed (as in | |
52 | <citerefentry><refentrytitle>sd_bus_close</refentrytitle><manvolnum>3</manvolnum></citerefentry>) | |
53 | during the exit phase of the event loop. This logic only applies to bus connections that are | |
54 | attached to an | |
55 | <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
56 | event loop, see | |
57 | <citerefentry><refentrytitle>sd_bus_attach_event</refentrytitle><manvolnum>3</manvolnum></citerefentry>. | |
58 | By default this mechanism is enabled and makes sure that any pending messages that have not been | |
59 | written to the bus connection are written out when the event loop is shutting down. In some | |
60 | cases this behaviour is not desirable, for example when the bus connection shall remain usable | |
61 | until after the event loop exited. If <parameter>b</parameter> is true, the feature is enabled | |
62 | (which is the default), otherwise disabled.</para> | |
63 | ||
64 | <para><function>sd_bus_get_close_on_exit()</function> may be used to query the current setting | |
65 | of this feature. It returns zero when the feature is disabled, and positive if enabled.</para> | |
c4e48030 LP |
66 | </refsect1> |
67 | ||
68 | <refsect1> | |
69 | <title>Return Value</title> | |
70 | ||
23139f89 DDM |
71 | <para>On success, <function>sd_bus_set_close_on_exit()</function> returns a non-negative |
72 | integer. On failure, it returns a negative errno-style error code.</para> | |
c4e48030 | 73 | |
23139f89 DDM |
74 | <para><function>sd_bus_get_close_on_exit()</function> returns 0 if the feature is currently |
75 | disabled or a positive integer if it is enabled. On failure, it returns a negative errno-style | |
76 | error code.</para> | |
c4e48030 | 77 | |
b1de39de ZJS |
78 | <refsect2> |
79 | <title>Errors</title> | |
c4e48030 | 80 | |
b1de39de | 81 | <para>Returned errors may indicate the following problems:</para> |
c4e48030 | 82 | |
b1de39de ZJS |
83 | <variablelist> |
84 | <varlistentry> | |
85 | <term><constant>-ECHILD</constant></term> | |
c4e48030 | 86 | |
23139f89 DDM |
87 | <listitem><para>The bus connection was created in a different process.</para> |
88 | </listitem> | |
b1de39de ZJS |
89 | </varlistentry> |
90 | </variablelist> | |
91 | </refsect2> | |
c4e48030 LP |
92 | </refsect1> |
93 | ||
94 | <xi:include href="libsystemd-pkgconfig.xml" /> | |
95 | ||
96 | <refsect1> | |
97 | <title>See Also</title> | |
98 | ||
99 | <para> | |
100 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
101 | <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
102 | <citerefentry><refentrytitle>sd_bus_flush</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
103 | <citerefentry><refentrytitle>sd_bus_attach_event</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
104 | <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
105 | <citerefentry><refentrytitle>sd_event_add_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
106 | </para> | |
107 | </refsect1> | |
c4e48030 | 108 | </refentry> |