]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_event_exit.xml
man: fix link markup
[thirdparty/systemd.git] / man / sd_event_exit.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+ -->
5
6 <refentry id="sd_event_exit" xmlns:xi="http://www.w3.org/2001/XInclude">
7
8 <refentryinfo>
9 <title>sd_event_exit</title>
10 <productname>systemd</productname>
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>sd_event_exit</refentrytitle>
15 <manvolnum>3</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>sd_event_exit</refname>
20 <refname>sd_event_get_exit_code</refname>
21
22 <refpurpose>Ask the event loop to exit</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_exit</function></funcdef>
31 <paramdef>sd_event *<parameter>event</parameter></paramdef>
32 <paramdef>int <parameter>code</parameter></paramdef>
33 </funcprototype>
34
35 <funcprototype>
36 <funcdef>int <function>sd_event_get_exit_code</function></funcdef>
37 <paramdef>sd_event *<parameter>event</parameter></paramdef>
38 <paramdef>int *<parameter>code</parameter></paramdef>
39 </funcprototype>
40
41 </funcsynopsis>
42 </refsynopsisdiv>
43
44 <refsect1>
45 <title>Description</title>
46
47 <para><function>sd_event_exit()</function> requests the event loop
48 specified in the <parameter>event</parameter> event loop object to
49 exit. The <parameter>code</parameter> parameter may be any integer
50 value and is returned as-is by
51 <citerefentry><refentrytitle>sd_event_loop</refentrytitle><manvolnum>3</manvolnum></citerefentry>
52 after the last event loop iteration. It may also be queried
53 using <function>sd_event_get_exit_code()</function>, see
54 below. </para>
55
56 <para>When exiting is requested the event loop will stop listening
57 for and dispatching regular event sources. Instead it will proceed
58 with executing only event sources registered with
59 <citerefentry><refentrytitle>sd_event_add_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>
60 in the order defined by their priority. After all exit event
61 sources have been dispatched the event loop is terminated.</para>
62
63 <para>If <function>sd_event_exit()</function> is invoked a second
64 time while the event loop is still processing exit event sources,
65 the exit code stored in the event loop object is updated, but
66 otherwise no further operation is executed.</para>
67
68 <para><function>sd_event_get_exit_code()</function> may be used to
69 query the exit code passed into
70 <function>sd_event_exit()</function> earlier.</para>
71
72 <para>While the full positive and negative integer ranges may be used
73 for the exit code, care should be taken not pick exit codes that
74 conflict with regular exit codes returned by
75 <function>sd_event_loop()</function>, if these exit codes shall be
76 distinguishable.</para>
77 </refsect1>
78
79 <refsect1>
80 <title>Return Value</title>
81
82 <para>On success, <function>sd_event_exit()</function> and <function>sd_event_get_exit_code()</function>
83 return 0 or a positive integer. On failure, they return a negative errno-style error code.</para>
84
85 <refsect2>
86 <title>Errors</title>
87
88 <para>Returned errors may indicate the following problems:</para>
89
90 <variablelist>
91
92 <varlistentry>
93 <term><constant>-EINVAL</constant></term>
94
95 <listitem><para>The event loop object or error code pointer are invalid.</para></listitem>
96
97 </varlistentry>
98
99 <varlistentry>
100 <term><constant>-ECHILD</constant></term>
101
102 <listitem><para>The event loop was created in a different process.</para></listitem>
103 </varlistentry>
104
105 <varlistentry>
106 <term><constant>-ESTALE</constant></term>
107
108 <listitem><para>The event loop has exited already and all exit handlers are already processed.
109 </para></listitem>
110 </varlistentry>
111
112 <varlistentry>
113 <term><constant>-ENODATA</constant></term>
114
115 <listitem><para>The event loop has not been requested to exit yet.</para></listitem>
116 </varlistentry>
117
118 </variablelist>
119 </refsect2>
120 </refsect1>
121
122 <xi:include href="libsystemd-pkgconfig.xml" />
123
124 <refsect1>
125 <title>See Also</title>
126
127 <para>
128 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
129 <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
130 <citerefentry><refentrytitle>sd_event_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
131 <citerefentry><refentrytitle>sd_event_add_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>
132 </para>
133 </refsect1>
134
135 </refentry>