]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/sd_bus_negotiate_fds.xml
TODO: Remove Elapsed Time DHCPv6 option as it is done
[thirdparty/systemd.git] / man / sd_bus_negotiate_fds.xml
CommitLineData
ce236b57
LP
1<?xml version='1.0'?> <!--*-nxml-*-->
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5<!--
6This file is part of systemd.
7
8Copyright 2014 Lennart Poettering
9
10systemd is free software; you can redistribute it and/or modify it
11under the terms of the GNU Lesser General Public License as published by
12the Free Software Foundation; either version 2.1 of the License, or
13(at your option) any later version.
14
15systemd is distributed in the hope that it will be useful, but
16WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18Lesser General Public License for more details.
19
20You should have received a copy of the GNU Lesser General Public License
21along with systemd; If not, see <http://www.gnu.org/licenses/>.
22-->
23
24<refentry id="sd_bus_negotiate_fds" conditional="ENABLE_KDBUS">
25
26 <refentryinfo>
faae655d 27 <title>sd_bus_negotiate_fds</title>
ce236b57
LP
28 <productname>systemd</productname>
29
30 <authorgroup>
31 <author>
32 <contrib>Developer</contrib>
33 <firstname>Lennart</firstname>
34 <surname>Poettering</surname>
35 <email>lennart@poettering.net</email>
36 </author>
37 </authorgroup>
38 </refentryinfo>
39
40 <refmeta>
41 <refentrytitle>sd_bus_negotiate_fds</refentrytitle>
42 <manvolnum>3</manvolnum>
43 </refmeta>
44
45 <refnamediv>
46 <refname>sd_bus_negotiate_fds</refname>
47 <refname>sd_bus_negotiate_timestamps</refname>
48 <refname>sd_bus_negotiate_creds</refname>
49
50 <refpurpose>Control feature negotiation on bus connections</refpurpose>
51 </refnamediv>
52
53 <refsynopsisdiv>
54 <funcsynopsis>
55 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
56
57 <funcprototype>
58 <funcdef>int <function>sd_bus_negotiate_fds</function></funcdef>
59 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
60 <paramdef>int <parameter>b</parameter></paramdef>
61 </funcprototype>
62
63 <funcprototype>
64 <funcdef>int <function>sd_bus_negotiate_timestamp</function></funcdef>
65 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
66 <paramdef>int <parameter>b</parameter></paramdef>
67 </funcprototype>
68
69 <funcprototype>
70 <funcdef>int <function>sd_bus_negotiate_creds</function></funcdef>
71 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
72 <paramdef>int <parameter>b</parameter></paramdef>
73 </funcprototype>
74 </funcsynopsis>
75 </refsynopsisdiv>
76
77 <refsect1>
78 <title>Description</title>
79
80 <para><function>sd_bus_negotiate_fds()</function> controls whether
81 file descriptor passing shall be negotiated for the specified bus
b8bde116
JE
82 connection. It takes a bus object and a boolean, which, when true,
83 enables file descriptor passing, and, when false, disables it. Note
ce236b57
LP
84 that not all transports and servers support file descriptor
85 passing. To find out whether file descriptor passing is available
b8bde116 86 after negotiation, use
ce236b57
LP
87 <citerefentry><refentrytitle>sd_bus_can_send</refentrytitle><manvolnum>3</manvolnum></citerefentry>
88 and pass <constant>SD_BUS_TYPE_UNIX_FD</constant>. Note that file
89 descriptor passing is always enabled for both sending and
90 receiving or for neither, but never only in one direction. By
b8bde116 91 default, file descriptor passing is negotiated for all
ce236b57
LP
92 connections.</para>
93
b8bde116 94 <para>Note that when bus activation is used, it is highly
ce236b57
LP
95 recommended to set the <option>AcceptFileDescriptors=</option>
96 setting in the <filename>.busname</filename> unit file to the same
97 setting as negotiated by the program ultimately activated. By
b8bde116 98 default, file descriptor passing is enabled for both.</para>
ce236b57
LP
99
100 <para><function>sd_bus_negotiate_timestamps()</function> controls
101 whether implicit sender timestamps shall be attached automatically
b8bde116
JE
102 to all incoming messages. Takes a bus object and a boolean, which,
103 when true, enables timestamping, and, when false, disables it. If
ce236b57
LP
104 this is disabled,
105 <citerefentry><refentrytitle>sd_bus_message_get_monotonic_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
106 <citerefentry><refentrytitle>sd_bus_message_get_realtime_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
107 <citerefentry><refentrytitle>sd_bus_message_get_seqno</refentrytitle><manvolnum>3</manvolnum></citerefentry>
108 fail with <constant>-ENODATA</constant> on incoming messages. Note
109 that not all transports support timestamping of messages. On local
b8bde116 110 transports, the timestamping is applied by the kernel and cannot be
ce236b57
LP
111 manipulated by userspace.</para>
112
113 <para><function>sd_bus_negotiate_creds()</function> controls
114 whether implicit sender credentials shall be attached
115 automatically to all incoming messages. Takes a bus object and a
116 bit mask value, which controls which credential parameters are
117 attached. If this is not used,
118 <citerefentry><refentrytitle>sd_bus_message_get_creds</refentrytitle><manvolnum>3</manvolnum></citerefentry>
119 fails with <constant>-ENODATA</constant> on incoming
120 messages. Note that not all transports support attaching sender
121 credentials to messages, or do not support all types of sender
b8bde116 122 credential parameters. On local transports, the sender credentials
ce236b57 123 are attached by the kernel and cannot be manipulated by
b8bde116 124 userspace. By default, no sender credentials are attached.</para>
ce236b57
LP
125
126 <para>These functions may be called only before the connection has
127 been started with
128 <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
129 </refsect1>
130
131 <refsect1>
132 <title>Return Value</title>
133
134 <para>On success, these functions returns 0 or a
faae655d 135 positive integer. On failure, they return a negative errno-style
ce236b57
LP
136 error code.</para>
137 </refsect1>
138
139 <refsect1>
140 <title>Errors</title>
141
142 <para>Returned errors may indicate the following problems:</para>
143
144 <variablelist>
145 <varlistentry>
146 <term><varname>-EPERM</varname></term>
147
148 <listitem><para>The bus connection has already been started.</para></listitem>
149 </varlistentry>
150 </variablelist>
151 </refsect1>
152
153 <refsect1>
154 <title>Notes</title>
155
156 <para><function>sd_bus_negotiate_fs()</function> and the other
157 functions described here are available as a shared library, which
158 can be compiled and linked to with the
5aded369 159 <constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
ce236b57
LP
160 file.</para>
161 </refsect1>
162
163 <refsect1>
164 <title>See Also</title>
165
166 <para>
167 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
168 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
169 <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
170 <citerefentry><refentrytitle>sd_bus_message_can_send</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
171 <citerefentry><refentrytitle>sd_bus_message_get_monotonic_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
172 <citerefentry><refentrytitle>sd_bus_message_get_creds</refentrytitle><manvolnum>3</manvolnum></citerefentry>
173 </para>
174 </refsect1>
175
176</refentry>