Debian Codegraph @

upstream/debian-unstable/man3/sd_bus_set_fd.3

raw
1 '\" t
2 .TH "SD_BUS_SET_FD" "3" "" "systemd 261~rc3" "sd_bus_set_fd"
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_fd \- Set the file descriptors to use for bus communication
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_fd('u
32 .BI "int sd_bus_set_fd(sd_bus\ *" "bus" ", int\ " "input_fd" ", int\ " "output_fd" ");"
33 .SH "DESCRIPTION"
34 .PP
35 \fBsd_bus_set_fd()\fR
36 sets the file descriptors used to communicate by a bus connection object\&. Both
37 \fIinput_fd\fR
38 and
39 \fIoutput_fd\fR
40 must be valid file descriptors, referring to stream\-based file objects (e\&.g\&. a stream socket, a pair of pipes or FIFOs, or even a TTY device)\&.
41 \fIinput_fd\fR
42 must be readable, and
43 \fIoutput_fd\fR
44 must be writable\&. The same file descriptor may be used (and typically is used) as both the input and the output file descriptor\&. This function must be called before the bus connection is started via
45 \fBsd_bus_start\fR(3)\&.
46 .PP
47 The bus connection object will take possession of the passed file descriptors and will close them automatically when it is freed\&. Use
48 \fBsd_bus_set_close_on_exit\fR(3)
49 to turn off this behaviour\&.
50 .SH "RETURN VALUE"
51 .PP
52 On success,
53 \fBsd_bus_set_fd()\fR
54 returns a non\-negative integer\&. On failure, it returns a negative errno\-style error code\&.
55 .SS "Errors"
56 .PP
57 Returned errors may indicate the following problems:
58 .PP
59 \fB\-EINVAL\fR
60 .RS 4
61 An invalid bus object was passed\&.
62 .sp
63 Added in version 248\&.
64 .RE
65 .PP
66 \fB\-ECHILD\fR
67 .RS 4
68 The bus connection was allocated in a parent process and is being reused in a child process after
69 \fBfork()\fR\&.
70 .sp
71 Added in version 248\&.
72 .RE
73 .PP
74 \fB\-EBADF\fR
75 .RS 4
76 An invalid file descriptor was passed to
77 \fBsd_bus_set_fd()\fR\&.
78 .sp
79 Added in version 248\&.
80 .RE
81 .PP
82 \fB\-ENOPKG\fR
83 .RS 4
84 The bus cannot be resolved\&.
85 .sp
86 Added in version 248\&.
87 .RE
88 .PP
89 \fB\-EPERM\fR
90 .RS 4
91 The bus connection has already been started\&.
92 .sp
93 Added in version 248\&.
94 .RE
95 .SH "NOTES"
96 .PP
97 Functions described here are available as a shared library, which can be compiled against and linked to with the
98 \fBlibsystemd\fR\ \&\fBpkg-config\fR(1)
99 file\&.
100 .PP
101 The code described here uses
102 \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
103 \fBsetenv\fR(3)
104 from a parallel thread\&. It is recommended to only do calls to
105 \fBsetenv()\fR
106 from an early phase of the program when no other threads have been started\&.
107 .SH "HISTORY"
108 .PP
109 \fBsd_bus_set_fd()\fR
110 was added in version 248\&.
111 .SH "SEE ALSO"
112 .PP
113 \fBsystemd\fR(1), \fBsd-bus\fR(3), \fBsd_bus_get_fd\fR(3), \fBsd_bus_start\fR(3)