Debian Codegraph @

upstream/debian-unstable/man3/sd_bus_set_close_on_exit.3

raw
1 '\" t
2 .TH "SD_BUS_SET_CLOSE_ON_EXIT" "3" "" "systemd 261~rc3" "sd_bus_set_close_on_exit"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 sd_bus_set_close_on_exit, sd_bus_get_close_on_exit \- Control whether to close the bus connection during the event loop exit phase
24 .SH "SYNOPSIS"
25 .sp
26 .ft B
27 .nf
28 #include <systemd/sd\-bus\&.h>
29 .fi
30 .ft
31 .HP \w'int\ sd_bus_set_close_on_exit('u
32 .BI "int sd_bus_set_close_on_exit(sd_bus\ *" "bus" ", int\ " "b" ");"
33 .HP \w'int\ sd_bus_get_close_on_exit('u
34 .BI "int sd_bus_get_close_on_exit(sd_bus\ *" "bus" ");"
35 .SH "DESCRIPTION"
36 .PP
37 \fBsd_bus_set_close_on_exit()\fR
38 may be used to enable or disable whether the bus connection is automatically flushed (as in
39 \fBsd_bus_flush\fR(3)) and closed (as in
40 \fBsd_bus_close\fR(3)) during the exit phase of the event loop\&. This logic only applies to bus connections that are attached to an
41 \fBsd-event\fR(3)
42 event loop, see
43 \fBsd_bus_attach_event\fR(3)\&. By default, this mechanism is enabled and makes sure that any pending messages that have not been written to the bus connection are written out when the event loop is shutting down\&. In some cases this behaviour is not desirable, for example when the bus connection shall remain usable until after the event loop exited\&. If
44 \fIb\fR
45 is true, the feature is enabled (which is the default), otherwise disabled\&.
46 .PP
47 \fBsd_bus_get_close_on_exit()\fR
48 may be used to query the current setting of this feature\&. It returns zero when the feature is disabled, and positive if enabled\&.
49 .SH "RETURN VALUE"
50 .PP
51 On success,
52 \fBsd_bus_set_close_on_exit()\fR
53 returns a non\-negative integer\&. On failure, it returns a negative errno\-style error code\&.
54 .PP
55 \fBsd_bus_get_close_on_exit()\fR
56 returns 0 if the feature is currently disabled or a positive integer if it is enabled\&. On failure, it returns a negative errno\-style error code\&.
57 .SS "Errors"
58 .PP
59 Returned errors may indicate the following problems:
60 .PP
61 \fB\-ECHILD\fR
62 .RS 4
63 The bus connection was created in a different process, library or module instance\&.
64 .RE
65 .SH "NOTES"
66 .PP
67 Functions described here are available as a shared library, which can be compiled against and linked to with the
68 \fBlibsystemd\fR\ \&\fBpkg-config\fR(1)
69 file\&.
70 .PP
71 The code described here uses
72 \fBgetenv\fR(3), which is declared to be not multi\-thread\-safe\&. This means that the code calling the functions described here must not call
73 \fBsetenv\fR(3)
74 from a parallel thread\&. It is recommended to only do calls to
75 \fBsetenv()\fR
76 from an early phase of the program when no other threads have been started\&.
77 .SH "HISTORY"
78 .PP
79 \fBsd_bus_set_close_on_exit()\fR
80 and
81 \fBsd_bus_get_close_on_exit()\fR
82 were added in version 240\&.
83 .SH "SEE ALSO"
84 .PP
85 \fBsystemd\fR(1), \fBsd-bus\fR(3), \fBsd_bus_flush\fR(3), \fBsd_bus_attach_event\fR(3), \fBsd-event\fR(3), \fBsd_event_add_exit\fR(3)