Debian Codegraph @

upstream/debian-unstable/man3/sd_bus_set_exit_on_disconnect.3

raw
1 '\" t
2 .TH "SD_BUS_SET_EXIT_ON_DISCONNECT" "3" "" "systemd 261~rc3" "sd_bus_set_exit_on_disconnect"
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_exit_on_disconnect, sd_bus_get_exit_on_disconnect \- Control the exit behavior when the bus object disconnects
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_exit_on_disconnect('u
32 .BI "int sd_bus_set_exit_on_disconnect(sd_bus\ *" "bus" ", int\ " "b" ");"
33 .HP \w'int\ sd_bus_get_exit_on_disconnect('u
34 .BI "int sd_bus_get_exit_on_disconnect(sd_bus\ *" "bus" ");"
35 .SH "DESCRIPTION"
36 .PP
37 \fBsd_bus_set_exit_on_disconnect()\fR
38 may be used to configure the exit behavior when the given bus object disconnects\&. If
39 \fIb\fR
40 is zero, no special logic is executed when the bus object disconnects\&. If
41 \fIb\fR
42 is non\-zero, the behavior on disconnect depends on whether the bus object is attached to an event loop or not\&. If the bus object is attached to an event loop (see
43 \fBsd_bus_attach_event\fR(3)), the event loop is closed when the bus object disconnects (as if calling
44 \fBsd_event_exit\fR(3))\&. Otherwise,
45 \fBexit\fR(3)
46 is called\&. The exit code passed to
47 \fBsd_event_exit()\fR
48 and
49 \fBexit()\fR
50 is
51 \fBEXIT_FAILURE\fR\&. If the bus object has already disconnected when enabling the exit behavior, the exit behavior is executed immediately\&. By default, the exit behavior is disabled\&.
52 .PP
53 \fBsd_bus_get_exit_on_disconnect()\fR
54 returns whether the exit on disconnect behavior is enabled for the given bus object\&.
55 .SH "RETURN VALUE"
56 .PP
57 On success,
58 \fBsd_bus_set_exit_on_disconnect()\fR
59 returns a non\-negative integer\&. On failure, it returns a negative errno\-style error code\&.
60 .PP
61 \fBsd_bus_get_exit_on_disconnect()\fR
62 returns a positive integer if the exit on disconnect behavior is enabled\&. Otherwise, it returns zero\&.
63 .SS "Errors"
64 .PP
65 Returned errors may indicate the following problems:
66 .PP
67 \fB\-EINVAL\fR
68 .RS 4
69 A required parameter was
70 \fBNULL\fR\&.
71 .sp
72 Added in version 246\&.
73 .RE
74 .PP
75 \fB\-ENOPKG\fR
76 .RS 4
77 The bus object could not be resolved\&.
78 .sp
79 Added in version 246\&.
80 .RE
81 .PP
82 \fB\-ECHILD\fR
83 .RS 4
84 The bus connection was created in a different process, library or module instance\&.
85 .sp
86 Added in version 246\&.
87 .RE
88 .SH "NOTES"
89 .PP
90 Functions described here are available as a shared library, which can be compiled against and linked to with the
91 \fBlibsystemd\fR\ \&\fBpkg-config\fR(1)
92 file\&.
93 .PP
94 The code described here uses
95 \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
96 \fBsetenv\fR(3)
97 from a parallel thread\&. It is recommended to only do calls to
98 \fBsetenv()\fR
99 from an early phase of the program when no other threads have been started\&.
100 .SH "HISTORY"
101 .PP
102 \fBsd_bus_set_exit_on_disconnect()\fR
103 and
104 \fBsd_bus_get_exit_on_disconnect()\fR
105 were added in version 246\&.
106 .SH "SEE ALSO"
107 .PP
108 \fBsystemd\fR(1), \fBsd-bus\fR(3), \fBsd_bus_attach_event\fR(3), \fBsd-event\fR(3), \fBsd_event_exit\fR(3)