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.
50
52 These APIs are implemented as a shared library, which can be compiled
53 and linked to with the libsystemd pkg-config(1) file.
54
56 systemd(1), sd-bus(3), sd_bus_attach_event(3), sd-event(3),
57 sd_event_exit(3)
58
59
60
61systemd 246 SD_BUS_SET_EXIT_ON_DISCONNECT(3)