]>
Commit | Line | Data |
---|---|---|
3802a3d3 | 1 | <?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*--> |
ce236b57 LP |
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 | <!-- | |
5de0ccff | 6 | This file is part of systemd. |
ce236b57 | 7 | |
5de0ccff | 8 | Copyright 2014 Lennart Poettering |
ce236b57 | 9 | |
5de0ccff ZJS |
10 | systemd is free software; you can redistribute it and/or modify it |
11 | under the terms of the GNU Lesser General Public License as published by | |
12 | the Free Software Foundation; either version 2.1 of the License, or | |
13 | (at your option) any later version. | |
ce236b57 | 14 | |
5de0ccff ZJS |
15 | systemd is distributed in the hope that it will be useful, but |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | Lesser General Public License for more details. | |
ce236b57 | 19 | |
5de0ccff ZJS |
20 | You should have received a copy of the GNU Lesser General Public License |
21 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
ce236b57 LP |
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 <systemd/sd-bus.h></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> | |
b5dae4c7 | 73 | <paramdef>uint64_t <parameter>flags</parameter></paramdef> |
ce236b57 LP |
74 | </funcprototype> |
75 | </funcsynopsis> | |
76 | </refsynopsisdiv> | |
77 | ||
78 | <refsect1> | |
79 | <title>Description</title> | |
80 | ||
81 | <para><function>sd_bus_negotiate_fds()</function> controls whether | |
82 | file descriptor passing shall be negotiated for the specified bus | |
b8bde116 JE |
83 | connection. It takes a bus object and a boolean, which, when true, |
84 | enables file descriptor passing, and, when false, disables it. Note | |
ce236b57 LP |
85 | that not all transports and servers support file descriptor |
86 | passing. To find out whether file descriptor passing is available | |
b8bde116 | 87 | after negotiation, use |
ce236b57 LP |
88 | <citerefentry><refentrytitle>sd_bus_can_send</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
89 | and pass <constant>SD_BUS_TYPE_UNIX_FD</constant>. Note that file | |
90 | descriptor passing is always enabled for both sending and | |
91 | receiving or for neither, but never only in one direction. By | |
b8bde116 | 92 | default, file descriptor passing is negotiated for all |
ce236b57 LP |
93 | connections.</para> |
94 | ||
b8bde116 | 95 | <para>Note that when bus activation is used, it is highly |
ce236b57 LP |
96 | recommended to set the <option>AcceptFileDescriptors=</option> |
97 | setting in the <filename>.busname</filename> unit file to the same | |
98 | setting as negotiated by the program ultimately activated. By | |
b8bde116 | 99 | default, file descriptor passing is enabled for both.</para> |
ce236b57 LP |
100 | |
101 | <para><function>sd_bus_negotiate_timestamps()</function> controls | |
102 | whether implicit sender timestamps shall be attached automatically | |
b8bde116 JE |
103 | to all incoming messages. Takes a bus object and a boolean, which, |
104 | when true, enables timestamping, and, when false, disables it. If | |
ce236b57 LP |
105 | this is disabled, |
106 | <citerefentry><refentrytitle>sd_bus_message_get_monotonic_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
107 | <citerefentry><refentrytitle>sd_bus_message_get_realtime_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
ae937639 | 108 | <citerefentry><refentrytitle>sd_bus_message_get_seqnum</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
ce236b57 LP |
109 | fail with <constant>-ENODATA</constant> on incoming messages. Note |
110 | that not all transports support timestamping of messages. On local | |
b5dae4c7 LP |
111 | transports, the timestamping is applied by the kernel and cannot |
112 | be manipulated by userspace. By default, message timestamping is | |
113 | not negotiated for all connections.</para> | |
ce236b57 LP |
114 | |
115 | <para><function>sd_bus_negotiate_creds()</function> controls | |
116 | whether implicit sender credentials shall be attached | |
b5dae4c7 | 117 | automatically to all incoming messages. Takes a bus object, a |
f131770b | 118 | boolean indicating whether to enable or disable the credential |
b5dae4c7 LP |
119 | parts encoded in the bit mask value argument. Note that not all |
120 | transports support attaching sender credentials to messages, or do | |
121 | not support all types of sender credential parameters, or might | |
122 | suppress them under certain circumstances for individual | |
123 | messages. On local transports, the sender credentials are attached | |
124 | by the kernel and cannot be manipulated by userspace. By default, | |
125 | no sender credentials are attached.</para> | |
126 | ||
127 | <para>The <function>sd_bus_negotiate_fds()</function> function may | |
128 | be called only before the connection has been started with | |
129 | <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>. Both | |
130 | <function>sd_bus_negotiate_timestamp()</function> and | |
131 | <function>sd_bus_negotiate_creds()</function> also may be called | |
132 | after a connection has been set up. Note that when operating on a | |
133 | connection that is shared between multiple components of the same | |
134 | program (for example via | |
135 | <citerefentry><refentrytitle>sd_bus_default</refentrytitle><manvolnum>3</manvolnum></citerefentry>) | |
136 | it is highly recommended to only enable additional per message | |
137 | metadata fields, but never disable them again, in order not to | |
138 | disable functionality needed by other components.</para> | |
ce236b57 LP |
139 | </refsect1> |
140 | ||
141 | <refsect1> | |
142 | <title>Return Value</title> | |
143 | ||
144 | <para>On success, these functions returns 0 or a | |
faae655d | 145 | positive integer. On failure, they return a negative errno-style |
ce236b57 LP |
146 | error code.</para> |
147 | </refsect1> | |
148 | ||
149 | <refsect1> | |
150 | <title>Errors</title> | |
151 | ||
152 | <para>Returned errors may indicate the following problems:</para> | |
153 | ||
154 | <variablelist> | |
155 | <varlistentry> | |
8474b70c | 156 | <term><constant>-EPERM</constant></term> |
ce236b57 LP |
157 | |
158 | <listitem><para>The bus connection has already been started.</para></listitem> | |
159 | </varlistentry> | |
160 | </variablelist> | |
161 | </refsect1> | |
162 | ||
163 | <refsect1> | |
164 | <title>Notes</title> | |
165 | ||
166 | <para><function>sd_bus_negotiate_fs()</function> and the other | |
167 | functions described here are available as a shared library, which | |
168 | can be compiled and linked to with the | |
5aded369 | 169 | <constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
ce236b57 LP |
170 | file.</para> |
171 | </refsect1> | |
172 | ||
173 | <refsect1> | |
174 | <title>See Also</title> | |
175 | ||
176 | <para> | |
177 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
178 | <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
179 | <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
180 | <citerefentry><refentrytitle>sd_bus_message_can_send</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
181 | <citerefentry><refentrytitle>sd_bus_message_get_monotonic_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
b5dae4c7 LP |
182 | <citerefentry><refentrytitle>sd_bus_message_get_creds</refentrytitle><manvolnum>3</manvolnum></citerefentry>, |
183 | <citerefentry><refentrytitle>systemd.busname</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
ce236b57 LP |
184 | </para> |
185 | </refsect1> | |
186 | ||
187 | </refentry> |