]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/sd_event_exit.xml
man: use same header for all files
[thirdparty/systemd.git] / man / sd_event_exit.xml
CommitLineData
514094f9 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+ -->
dc83f27a
LP
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>
dc83f27a
LP
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>
7f3fdb7f 52 after the last event loop iteration. It may also be queried
dc83f27a
LP
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
83 <function>sd_event_get_exit_code()</function> return 0 or a positive
84 integer. On failure, they return a negative errno-style error
85 code.</para>
86 </refsect1>
87
88 <refsect1>
89 <title>Errors</title>
90
91 <para>Returned errors may indicate the following problems:</para>
92
93 <variablelist>
94
95 <varlistentry>
96 <term><constant>-EINVAL</constant></term>
97
98 <listitem><para>The event loop object or error code pointer are invalid.</para></listitem>
99
100 </varlistentry>
101
102 <varlistentry>
103 <term><constant>-ECHILD</constant></term>
104
105 <listitem><para>The event loop was created in a different process.</para></listitem>
106 </varlistentry>
107
108 <varlistentry>
109 <term><constant>-ESTALE</constant></term>
110
111 <listitem><para>The event loop has exited already and all exit handlers are already processed.</para></listitem>
112 </varlistentry>
113
114 <varlistentry>
115 <term><constant>-ENODATA</constant></term>
116
117 <listitem><para>The event loop has not been requested to exit yet.</para></listitem>
118 </varlistentry>
119
120 </variablelist>
121 </refsect1>
122
123 <xi:include href="libsystemd-pkgconfig.xml" />
124
125 <refsect1>
126 <title>See Also</title>
127
128 <para>
129 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
130 <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
131 <citerefentry><refentrytitle>sd_event_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
132 <citerefentry><refentrytitle>sd_event_add_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>
133 </para>
134 </refsect1>
135
136</refentry>