Debian Codegraph @

upstream/debian-unstable/man3/sd_bus_is_open.3

raw
1 '\" t
2 .TH "SD_BUS_IS_OPEN" "3" "" "systemd 261~rc3" "sd_bus_is_open"
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_is_open, sd_bus_is_ready \- Check whether the bus connection is open or ready
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_is_open('u
32 .BI "int sd_bus_is_open(sd_bus\ *" "bus" ");"
33 .HP \w'int\ sd_bus_is_ready('u
34 .BI "int sd_bus_is_ready(sd_bus\ *" "bus" ");"
35 .SH "DESCRIPTION"
36 .PP
37 \fBsd_bus_is_open()\fR
38 checks whether the specified bus connection is open, i\&.e\&. in the process of being established, already established or in the process of being torn down\&. It returns zero when the connection has not been started yet (i\&.e\&.
39 \fBsd_bus_start\fR(3)
40 or some equivalent call has not been invoked yet), or is fully terminated again (for example after
41 \fBsd_bus_close\fR(3)), it returns positive otherwise\&.
42 .PP
43 \fBsd_bus_is_ready()\fR
44 checks whether the specified connection is fully established, i\&.e\&. completed the connection and authentication phases of the protocol and received the
45 \fBHello()\fR
46 method call response, and is not in the process of being torn down again\&. It returns zero outside of this state, and positive otherwise\&. Effectively, this function returns positive while regular messages can be sent or received on the connection\&.
47 .PP
48 The
49 \fIbus\fR
50 argument may be
51 \fBNULL\fR, zero is also returned in that case\&.
52 .PP
53 To be notified when the connection is fully established, use
54 \fBsd_bus_set_connected_signal\fR(3)
55 and install a match for the
56 \fBConnected()\fR
57 signal on the
58 "org\&.freedesktop\&.DBus\&.Local"
59 interface\&. To be notified when the connection is torn down again, install a match for the
60 \fBDisconnected()\fR
61 signal on the
62 "org\&.freedesktop\&.DBus\&.Local"
63 interface\&.
64 .SH "RETURN VALUE"
65 .PP
66 Those functions return 0 if the bus is
67 \fInot\fR
68 in the given state, and a positive integer when it is\&. On failure, a negative errno\-style error code is returned\&.
69 .SS "Errors"
70 .PP
71 Returned errors may indicate the following problems:
72 .PP
73 \fB\-ECHILD\fR
74 .RS 4
75 The bus connection has been created in a different process, library or module instance\&.
76 .RE
77 .SH "NOTES"
78 .PP
79 Functions described here are available as a shared library, which can be compiled against and linked to with the
80 \fBlibsystemd\fR\ \&\fBpkg-config\fR(1)
81 file\&.
82 .PP
83 The code described here uses
84 \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
85 \fBsetenv\fR(3)
86 from a parallel thread\&. It is recommended to only do calls to
87 \fBsetenv()\fR
88 from an early phase of the program when no other threads have been started\&.
89 .SH "HISTORY"
90 .PP
91 \fBsd_bus_is_open()\fR
92 was added in version 221\&.
93 .PP
94 \fBsd_bus_is_ready()\fR
95 was added in version 237\&.
96 .SH "SEE ALSO"
97 .PP
98 \fBsystemd\fR(1), \fBsd-bus\fR(3), \fBsd_bus_start\fR(3), \fBsd_bus_close\fR(3), \fBsd_bus_set_connected_signal\fR(3)