]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_event_source_set_exit_on_failure.xml
tree-wide: fix typo
[thirdparty/systemd.git] / man / sd_event_source_set_exit_on_failure.xml
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_event_source_set_exit_on_failure" xmlns:xi="http://www.w3.org/2001/XInclude">
7
8 <refentryinfo>
9 <title>sd_event_source_set_exit_on_failure</title>
10 <productname>systemd</productname>
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>sd_event_source_set_exit_on_failure</refentrytitle>
15 <manvolnum>3</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>sd_event_source_set_exit_on_failure</refname>
20 <refname>sd_event_source_get_exit_on_failure</refname>
21
22 <refpurpose>Set or retrieve the exit-on-failure feature of event sources</refpurpose>
23 </refnamediv>
24
25 <refsynopsisdiv>
26 <funcsynopsis>
27 <funcsynopsisinfo>#include &lt;systemd/sd-event.h&gt;</funcsynopsisinfo>
28
29 <funcprototype>
30 <funcdef>int <function>sd_event_source_set_exit_on_failure</function></funcdef>
31 <paramdef>sd_event_source *<parameter>source</parameter></paramdef>
32 <paramdef>int <parameter>b</parameter></paramdef>
33 </funcprototype>
34
35 <funcprototype>
36 <funcdef>int <function>sd_event_source_get_exit_on_failure</function></funcdef>
37 <paramdef>sd_event_source *<parameter>source</parameter></paramdef>
38 </funcprototype>
39
40 </funcsynopsis>
41 </refsynopsisdiv>
42
43 <refsect1>
44 <title>Description</title>
45
46 <para><function>sd_event_source_set_exit_on_failure()</function> may be used to set/unset the
47 exit-on-failure flag of the event source object specified as <parameter>source</parameter>. The flag
48 defaults to off. If on and the callback function set for the event source returns a failure code (i.e. a
49 negative value) the event loop is exited too, using the callback return code as the exit code for
50 <citerefentry><refentrytitle>sd_event_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>. If
51 off, the event source is disabled but the event loop continues to run. Setting this flag is useful for
52 "dominant" event sources that define the purpose and reason for the event loop, and whose failure hence
53 should propagate to the event loop itself — as opposed to "auxiliary" event sources whose failures should
54 remain local and affect the event source, but not propagate further.</para>
55
56 <para><function>sd_event_source_get_exit_on_failure()</function> may be used to query the flag currently
57 set for the event source object <parameter>source</parameter>.</para>
58 </refsect1>
59
60 <refsect1>
61 <title>Return Value</title>
62
63 <para>On success, <function>sd_event_source_set_exit_on_failure()</function> returns a non-negative
64 integer. <function>sd_event_source_get_exit_on_failure()</function> returns 0 if the flag is off, &gt; 0
65 if the flag is on. On failure, both return a negative errno-style error code.</para>
66
67 <refsect2>
68 <title>Errors</title>
69
70 <para>Returned errors may indicate the following problems:</para>
71
72 <variablelist>
73 <varlistentry>
74 <term><constant>-EINVAL</constant></term>
75
76 <listitem><para><parameter>source</parameter> is not a valid pointer to an
77 <structname>sd_event_source</structname> object.</para></listitem>
78 </varlistentry>
79
80 <varlistentry>
81 <term><constant>-EDOM</constant></term>
82
83 <listitem><para>The event source refers to an exit event source (as created with
84 <citerefentry><refentrytitle>sd_event_add_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>),
85 for which this functionality is not supported.</para></listitem>
86 </varlistentry>
87
88 </variablelist>
89 </refsect2>
90 </refsect1>
91
92 <xi:include href="libsystemd-pkgconfig.xml" />
93
94 <refsect1>
95 <title>See Also</title>
96
97 <para>
98 <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
99 <citerefentry><refentrytitle>sd_event_add_io</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
100 <citerefentry><refentrytitle>sd_event_add_time</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
101 <citerefentry><refentrytitle>sd_event_add_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
102 <citerefentry><refentrytitle>sd_event_add_child</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
103 <citerefentry><refentrytitle>sd_event_add_inotify</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
104 <citerefentry><refentrytitle>sd_event_add_defer</refentrytitle><manvolnum>3</manvolnum></citerefentry>
105 </para>
106 </refsect1>
107
108 </refentry>