1SD_BUS_SET_EXIT_ON_DISCONNsEdC_Tb(u3s)_set_exit_on_disScDo_nBnUeSc_tSET_EXIT_ON_DISCONNECT(3)
2
3
4
6 sd_bus_set_exit_on_disconnect, sd_bus_get_exit_on_disconnect - Control
7 the exit behavior when the bus object disconnects
8
10 #include <systemd/sd-bus.h>
11
12 int sd_bus_set_exit_on_disconnect(sd_bus *bus, int b);
13
14 int sd_bus_get_exit_on_disconnect(sd_bus *bus);
15
17 sd_bus_set_exit_on_disconnect() may be used to configure the exit
18 behavior when the given bus object disconnects. If b is zero, no
19 special logic is executed when the bus object disconnects. If b is
20 non-zero, the behavior on disconnect depends on whether the bus object
21 is attached to an event loop or not. If the bus object is attached to
22 an event loop (see sd_bus_attach_event(3)), the event loop is closed
23 when the bus object disconnects (as if calling sd_event_exit(3)).
24 Otherwise, exit(3) is called. The exit code passed to sd_event_exit()
25 and exit() is EXIT_FAILURE. If the bus object has already disconnected
26 when enabling the exit behavior, the exit behavior is executed
27 immediately. By default, the exit behavior is disabled.
28
29 sd_bus_get_exit_on_disconnect() returns whether the exit on disconnect
30 behavior is enabled for the given bus object.
31
33 On success, sd_bus_set_exit_on_disconnect() returns a non-negative
34 integer. On failure, it returns a negative errno-style error code.
35
36 sd_bus_get_exit_on_disconnect() returns a positive integer if the exit
37 on disconnect behavior is enabled. Otherwise, it returns zero.
38
39 Errors
40 Returned errors may indicate the following problems:
41
42 -EINVAL
43 A required parameter was NULL.
44
45 -ENOPKG
46 The bus object could not be resolved.
47
48 -ECHILD
49 The bus connection was created in a different process, library or
50 module instance.
51
53 Functions described here are available as a shared library, which can
54 be compiled against and linked to with the libsystemd pkg-config(1)
55 file.
56
57 The code described here uses getenv(3), which is declared to be not
58 multi-thread-safe. This means that the code calling the functions
59 described here must not call setenv(3) from a parallel thread. It is
60 recommended to only do calls to setenv() from an early phase of the
61 program when no other threads have been started.
62
64 systemd(1), sd-bus(3), sd_bus_attach_event(3), sd-event(3),
65 sd_event_exit(3)
66
67
68
69systemd 254 SD_BUS_SET_EXIT_ON_DISCONNECT(3)