| 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.5/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 <systemd/sd-event.h></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, > 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> |
| 78 |
|
| 79 |
<xi:include href="version-info.xml" xpointer="v247"/></listitem> |
| 80 |
</varlistentry> |
| 81 |
|
| 82 |
<varlistentry> |
| 83 |
<term><constant>-EDOM</constant></term> |
| 84 |
|
| 85 |
<listitem><para>The event source refers to an exit event source (as created with |
| 86 |
<citerefentry><refentrytitle>sd_event_add_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>), |
| 87 |
for which this functionality is not supported.</para> |
| 88 |
|
| 89 |
<xi:include href="version-info.xml" xpointer="v247"/></listitem> |
| 90 |
</varlistentry> |
| 91 |
|
| 92 |
</variablelist> |
| 93 |
</refsect2> |
| 94 |
</refsect1> |
| 95 |
|
| 96 |
<xi:include href="libsystemd-pkgconfig.xml" /> |
| 97 |
|
| 98 |
<refsect1> |
| 99 |
<title>History</title> |
| 100 |
<para><function>sd_event_source_set_exit_on_failure()</function> and |
| 101 |
<function>sd_event_source_get_exit_on_failure()</function> were added in version 247.</para> |
| 102 |
</refsect1> |
| 103 |
|
| 104 |
<refsect1> |
| 105 |
<title>See Also</title> |
| 106 |
|
| 107 |
<para><simplelist type="inline"> |
| 108 |
<member><citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 109 |
<member><citerefentry><refentrytitle>sd_event_add_io</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 110 |
<member><citerefentry><refentrytitle>sd_event_add_time</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 111 |
<member><citerefentry><refentrytitle>sd_event_add_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 112 |
<member><citerefentry><refentrytitle>sd_event_add_child</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 113 |
<member><citerefentry><refentrytitle>sd_event_add_inotify</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 114 |
<member><citerefentry><refentrytitle>sd_event_add_defer</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 115 |
</simplelist></para> |
| 116 |
</refsect1> |
| 117 |
|
| 118 |
</refentry> |