]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_bus_set_fd.xml
man: add version information for functions
[thirdparty/systemd.git] / man / sd_bus_set_fd.xml
1 <?xml version='1.0'?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6 SPDX-License-Identifier: LGPL-2.1-or-later
7
8 Copyright © 2016 Julian Orth
9 -->
10
11 <refentry id="sd_bus_set_fd" xmlns:xi="http://www.w3.org/2001/XInclude">
12
13 <refentryinfo>
14 <title>sd_bus_set_fd</title>
15 <productname>systemd</productname>
16 </refentryinfo>
17
18 <refmeta>
19 <refentrytitle>sd_bus_set_fd</refentrytitle>
20 <manvolnum>3</manvolnum>
21 </refmeta>
22
23 <refnamediv>
24 <refname>sd_bus_set_fd</refname>
25
26 <refpurpose>Set the file descriptors to use for bus communication</refpurpose>
27 </refnamediv>
28
29 <refsynopsisdiv>
30 <funcsynopsis>
31 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
32
33 <funcprototype>
34 <funcdef>int <function>sd_bus_set_fd</function></funcdef>
35 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
36 <paramdef>int <parameter>input_fd</parameter></paramdef>
37 <paramdef>int <parameter>output_fd</parameter></paramdef>
38 </funcprototype>
39 </funcsynopsis>
40 </refsynopsisdiv>
41
42 <refsect1>
43 <title>Description</title>
44
45 <para><function>sd_bus_set_fd()</function> sets the file descriptors used to communicate by a bus
46 connection object. Both <parameter>input_fd</parameter> and <parameter>output_fd</parameter> must be
47 valid file descriptors, referring to stream-based file objects (e.g. a stream socket, a pair of pipes or
48 FIFOs, or even a TTY device). <parameter>input_fd</parameter> must be readable, and
49 <parameter>output_fd</parameter> must be writable. The same file descriptor may be used (and typically is
50 used) as both the input and the output file descriptor. This function must be called before the bus
51 connection is started via
52 <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
53
54 <para>The bus connection object will take possession of the passed file descriptors and will close them
55 automatically when it is freed. Use
56 <citerefentry><refentrytitle>sd_bus_set_close_on_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>
57 to turn off this behaviour.</para>
58 </refsect1>
59
60 <refsect1>
61 <title>Return Value</title>
62
63 <para>On success, <function>sd_bus_set_fd()</function> returns a non-negative integer. On
64 failure, it returns a negative errno-style error code.</para>
65
66 <refsect2>
67 <title>Errors</title>
68
69 <para>Returned errors may indicate the following problems:</para>
70
71 <variablelist>
72 <varlistentry>
73 <term><constant>-EINVAL</constant></term>
74
75 <listitem><para>An invalid bus object was passed.</para>
76
77 <xi:include href="version-info.xml" xpointer="v248"/></listitem>
78 </varlistentry>
79
80 <varlistentry>
81 <term><constant>-ECHILD</constant></term>
82
83 <listitem><para>The bus connection was allocated in a parent process and is being reused
84 in a child process after <function>fork()</function>.</para>
85
86 <xi:include href="version-info.xml" xpointer="v248"/></listitem>
87 </varlistentry>
88
89 <varlistentry>
90 <term><constant>-EBADF</constant></term>
91
92 <listitem><para>An invalid file descriptor was passed to
93 <function>sd_bus_set_fd()</function>.</para>
94
95 <xi:include href="version-info.xml" xpointer="v248"/></listitem>
96 </varlistentry>
97
98 <varlistentry>
99 <term><constant>-ENOPKG</constant></term>
100
101 <listitem><para>The bus cannot be resolved.</para>
102
103 <xi:include href="version-info.xml" xpointer="v248"/></listitem>
104 </varlistentry>
105
106 <varlistentry>
107 <term><constant>-EPERM</constant></term>
108
109 <listitem><para>The bus connection has already been started.</para>
110
111 <xi:include href="version-info.xml" xpointer="v248"/></listitem>
112 </varlistentry>
113 </variablelist>
114 </refsect2>
115 </refsect1>
116
117 <xi:include href="libsystemd-pkgconfig.xml" />
118
119 <refsect1>
120 <title>History</title>
121 <para><function>sd_bus_set_fd()</function> was added in version 248.</para>
122 </refsect1>
123
124 <refsect1>
125 <title>See Also</title>
126
127 <para>
128 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
129 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
130 <citerefentry><refentrytitle>sd_bus_get_fd</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
131 <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>
132 </para>
133 </refsect1>
134
135 </refentry>