1SD_BUS_SET_FD(3) sd_bus_set_fd SD_BUS_SET_FD(3)
2
3
4
6 sd_bus_set_fd - Set the file descriptors to use for bus communication
7
9 #include <systemd/sd-bus.h>
10
11 int sd_bus_set_fd(sd_bus *bus, int input_fd, int output_fd);
12
14 sd_bus_set_fd() sets the file descriptors used to communicate by a bus
15 connection object. Both input_fd and output_fd must be valid file
16 descriptors, referring to stream-based file objects (e.g. a stream
17 socket, a pair of pipes or FIFOs, or even a TTY device). input_fd must
18 be readable, and output_fd must be writable. The same file descriptor
19 may be used (and typically is used) as both the input and the output
20 file descriptor. This function must be called before the bus connection
21 is started via sd_bus_start(3).
22
23 The bus connection object will take possession of the passed file
24 descriptors and will close them automatically when it is freed. Use
25 sd_bus_set_close_on_exit(3) to turn off this behaviour.
26
28 On success, sd_bus_set_fd() returns a non-negative integer. On failure,
29 it returns a negative errno-style error code.
30
31 Errors
32 Returned errors may indicate the following problems:
33
34 -EINVAL
35 An invalid bus object was passed.
36
37 -ECHILD
38 The bus connection was allocated in a parent process and is being
39 reused in a child process after fork().
40
41 -EBADF
42 An invalid file descriptor was passed to sd_bus_set_fd().
43
44 -ENOPKG
45 The bus cannot be resolved.
46
47 -EPERM
48 The bus connection has already been started.
49
51 These APIs are implemented as a shared library, which can be compiled
52 and linked to with the libsystemd pkg-config(1) file.
53
55 systemd(1), sd-bus(3), sd_bus_get_fd(3), sd_bus_start(3)
56
57
58
59systemd 250 SD_BUS_SET_FD(3)