1SD_BUS_SET_CLOSE_ON_EXIT(3)sd_bus_set_close_on_exitSD_BUS_SET_CLOSE_ON_EXIT(3)
2
3
4
6 sd_bus_set_close_on_exit, sd_bus_get_close_on_exit - Control whether to
7 close the bus connection during the event loop exit phase
8
10 #include <systemd/sd-bus.h>
11
12 int sd_bus_set_close_on_exit(sd_bus *bus, int b);
13
14 int sd_bus_get_close_on_exit(sd_bus *bus);
15
17 sd_bus_set_close_on_exit() may be used to enable or disable whether the
18 bus connection is automatically flushed (as in sd_bus_flush(3)) and
19 closed (as in sd_bus_close(3)) during the exit phase of the event loop.
20 This logic only applies to bus connections that are attached to an sd-
21 event(3) event loop, see sd_bus_attach_event(3). By default this
22 mechanism is enabled and makes sure that any pending messages that have
23 not been written to the bus connection are written out when the event
24 loop is shutting down. In some cases this behaviour is not desirable,
25 for example when the bus connection shall remain usable until after the
26 event loop exited. If b is true, the feature is enabled (which is the
27 default), otherwise disabled.
28
29 sd_bus_get_close_on_exit() may be used to query the current setting of
30 this feature. It returns zero when the feature is disabled, and
31 positive if enabled.
32
34 On success, sd_bus_set_close_on_exit() returns a non-negative integer.
35 On failure, it returns a negative errno-style error code.
36
37 sd_bus_get_close_on_exit() returns 0 if the feature is currently
38 disabled or a positive integer if it is enabled. On failure, it returns
39 a negative errno-style error code.
40
41 Errors
42 Returned errors may indicate the following problems:
43
44 -ECHILD
45 The bus connection was created in a different process.
46
48 These APIs are implemented as a shared library, which can be compiled
49 and linked to with the libsystemd pkg-config(1) file.
50
52 systemd(1), sd-bus(3), sd_bus_flush(3), sd_bus_attach_event(3), sd-
53 event(3), sd_event_add_exit(3)
54
55
56
57systemd 253 SD_BUS_SET_CLOSE_ON_EXIT(3)