1SD_EVENT_SOURCE_SET_EXIsTd__OeNv_eFnAtI_LsUoRuEr(c3e)_setS_De_xEiVtE_NoTn__SfOaUiRlCuEr_eSET_EXIT_ON_FAILURE(3)
2
3
4

NAME

6       sd_event_source_set_exit_on_failure,
7       sd_event_source_get_exit_on_failure - Set or retrieve the
8       exit-on-failure feature of event sources
9

SYNOPSIS

11       #include <systemd/sd-event.h>
12
13       int sd_event_source_set_exit_on_failure(sd_event_source *source,
14                                               int b);
15
16       int sd_event_source_get_exit_on_failure(sd_event_source *source);
17

DESCRIPTION

19       sd_event_source_set_exit_on_failure() may be used to set/unset the
20       exit-on-failure flag of the event source object specified as source.
21       The flag defaults to off. If on and the callback function set for the
22       event source returns a failure code (i.e. a negative value) the event
23       loop is exited too, using the callback return code as the exit code for
24       sd_event_exit(3). If off, the event source is disabled but the event
25       loop continues to run. Setting this flag is useful for "dominant" event
26       sources that define the purpose and reason for the event loop, and
27       whose failure hence should propagate to the event loop itself — as
28       opposed to "auxiliary" event sources whose failures should remain local
29       and affect the event source, but not propagate further.
30
31       sd_event_source_get_exit_on_failure() may be used to query the flag
32       currently set for the event source object source.
33

RETURN VALUE

35       On success, sd_event_source_set_exit_on_failure() returns a
36       non-negative integer.  sd_event_source_get_exit_on_failure() returns 0
37       if the flag is off, > 0 if the flag is on. On failure, both return a
38       negative errno-style error code.
39
40   Errors
41       Returned errors may indicate the following problems:
42
43       -EINVAL
44           source is not a valid pointer to an sd_event_source object.
45
46       -EDOM
47           The event source refers to an exit event source (as created with
48           sd_event_add_exit(3)), for which this functionality is not
49           supported.
50

NOTES

52       Functions described here are available as a shared library, which can
53       be compiled against and linked to with the libsystemd pkg-config(1)
54       file.
55
56       The code described here uses getenv(3), which is declared to be not
57       multi-thread-safe. This means that the code calling the functions
58       described here must not call setenv(3) from a parallel thread. It is
59       recommended to only do calls to setenv() from an early phase of the
60       program when no other threads have been started.
61

SEE ALSO

63       sd-event(3), sd_event_add_io(3), sd_event_add_time(3),
64       sd_event_add_signal(3), sd_event_add_child(3), sd_event_add_inotify(3),
65       sd_event_add_defer(3)
66
67
68
69systemd 254                             SD_EVENT_SOURCE_SET_EXIT_ON_FAILURE(3)
Impressum