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