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, library or
46 module instance.
47
49 Functions described here are available as a shared library, which can
50 be compiled against and linked to with the libsystemd pkg-config(1)
51 file.
52
53 The code described here uses getenv(3), which is declared to be not
54 multi-thread-safe. This means that the code calling the functions
55 described here must not call setenv(3) from a parallel thread. It is
56 recommended to only do calls to setenv() from an early phase of the
57 program when no other threads have been started.
58
60 systemd(1), sd-bus(3), sd_bus_flush(3), sd_bus_attach_event(3), sd-
61 event(3), sd_event_add_exit(3)
62
63
64
65systemd 254 SD_BUS_SET_CLOSE_ON_EXIT(3)