]>
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 | ||
23 | <refpurpose>Control whether to close the bus connection during the event loop exit phase</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_close_on_exit</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_close_on_exit</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_close_on_exit()</function> may be used to enable or disable whether the bus connection | |
48 | is automatically flushed (as in | |
49 | <citerefentry><refentrytitle>sd_bus_flush</refentrytitle><manvolnum>3</manvolnum></citerefentry>) and closed (as in | |
50 | <citerefentry><refentrytitle>sd_bus_close</refentrytitle><manvolnum>3</manvolnum></citerefentry>) during the exit | |
51 | phase of the event loop. This logic only applies to bus connections that are attached to an | |
52 | <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry> event loop, see | |
53 | <citerefentry><refentrytitle>sd_bus_attach_event</refentrytitle><manvolnum>3</manvolnum></citerefentry>. By default | |
54 | this mechanism is enabled and makes sure that any pending messages that have not been written to the bus connection | |
55 | are written out when the event loop is shutting down. In some cases this behaviour is not desirable, for example | |
56 | when the bus connection shall remain usable until after the event loop exited. If <parameter>b</parameter> is | |
57 | true, the feature is enabled (which is the default), otherwise disabled.</para> | |
58 | ||
59 | <para><function>sd_bus_get_close_on_exit()</function> may be used to query the current setting of this feature. It | |
60 | returns zero when the feature is disabled, and positive if enabled.</para> | |
61 | </refsect1> | |
62 | ||
63 | <refsect1> | |
64 | <title>Return Value</title> | |
65 | ||
66 | <para>On success, <function>sd_bus_set_close_on_exit()</function> returns 0 or a positive integer. On failure, it returns a negative errno-style | |
67 | error code.</para> | |
68 | ||
69 | <para><function>sd_bus_get_close_on_exit()</function> returns 0 if the feature is currently turned off or a | |
70 | positive integer if it is on. On failure, it returns a negative errno-style error code.</para> | |
71 | </refsect1> | |
72 | ||
73 | <refsect1> | |
74 | <title>Errors</title> | |
75 | ||
76 | <para>Returned errors may indicate the following problems:</para> | |
77 | ||
78 | <variablelist> | |
79 | <varlistentry> | |
80 | <term><constant>-ECHILD</constant></term> | |
81 | ||
82 | <listitem><para>The bus connection has been created in a different process.</para></listitem> | |
83 | </varlistentry> | |
84 | </variablelist> | |
85 | </refsect1> | |
86 | ||
87 | <xi:include href="libsystemd-pkgconfig.xml" /> | |
88 | ||
89 | <refsect1> | |
90 | <title>See Also</title> | |
91 | ||
92 | <para> | |
93 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
94 | <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
95 | <citerefentry><refentrytitle>sd_bus_flush</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
96 | <citerefentry><refentrytitle>sd_bus_attach_event</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
97 | <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
98 | <citerefentry><refentrytitle>sd_event_add_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
99 | </para> | |
100 | </refsect1> | |
101 | ||
102 | </refentry> |