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">
5 <refentry id="kdbus.endpoint">
8 <title>kdbus.endpoint</title>
9 <productname>kdbus.endpoint</productname>
13 <refentrytitle>kdbus.endpoint</refentrytitle>
14 <manvolnum>7</manvolnum>
18 <refname>kdbus.endpoint</refname>
19 <refpurpose>kdbus endpoint</refpurpose>
23 <title>Description</title>
26 Endpoints are entry points to a bus (see
28 <refentrytitle>kdbus.bus</refentrytitle>
29 <manvolnum>7</manvolnum>
31 By default, each bus has a default
32 endpoint called 'bus'. The bus owner has the ability to create custom
33 endpoints with specific names, permissions, and policy databases
34 (see below). An endpoint is presented as file underneath the directory
38 To create a custom endpoint, open the default endpoint
39 (<literal>bus</literal>) and use the
40 <constant>KDBUS_CMD_ENDPOINT_MAKE</constant> ioctl with
41 <type>struct kdbus_cmd</type>. Custom endpoints always have a policy
42 database that, by default, forbids any operation. You have to explicitly
43 install policy entries to allow any operation on this endpoint.
46 Once <constant>KDBUS_CMD_ENDPOINT_MAKE</constant> succeeded, the new
47 endpoint will appear in the filesystem
49 <refentrytitle>kdbus.bus</refentrytitle>
50 <manvolnum>7</manvolnum>
51 </citerefentry>), and the used file descriptor will manage the
52 newly created endpoint resource. It cannot be used to manage further
53 resources and must be kept open as long as the endpoint is needed. The
54 endpoint will be terminated as soon as the file descriptor is closed.
57 Endpoint names may be chosen freely except for one restriction: the name
58 must be prefixed with the numeric effective UID of the creator and a dash.
59 This is required to avoid namespace clashes between different users. When
60 creating an endpoint, the name that is passed in must be properly
61 formatted or the kernel will refuse creation of the endpoint. Example:
62 <literal>1047-my-endpoint</literal> is an acceptable name for an
63 endpoint registered by a user with UID 1047. However,
64 <literal>1024-my-endpoint</literal> is not, and neither is
65 <literal>my-endpoint</literal>. The UID must be provided in the
66 user-namespace of the bus.
69 To create connections to a bus, use <constant>KDBUS_CMD_HELLO</constant>
70 on a file descriptor returned by <function>open()</function> on an
73 <refentrytitle>kdbus.connection</refentrytitle>
74 <manvolnum>7</manvolnum>
81 <title>Creating custom endpoints</title>
83 To create a new endpoint, the
84 <constant>KDBUS_CMD_ENDPOINT_MAKE</constant> command is used. Along with
85 the endpoint's name, which will be used to expose the endpoint in the
87 <refentrytitle>kdbus.fs</refentrytitle>
88 <manvolnum>7</manvolnum>
90 the command also optionally takes items to set up the endpoint's
92 <refentrytitle>kdbus.policy</refentrytitle>
93 <manvolnum>7</manvolnum>
95 <constant>KDBUS_CMD_ENDPOINT_MAKE</constant> takes a
96 <type>struct kdbus_cmd</type> argument.
103 struct kdbus_item items[0];
107 <para>The fields in this struct are described below.</para>
111 <term><varname>size</varname></term>
113 The overall size of the struct, including its items.
118 <term><varname>flags</varname></term>
119 <listitem><para>The flags for creation.</para>
122 <term><constant>KDBUS_MAKE_ACCESS_GROUP</constant></term>
124 <para>Make the endpoint file group-accessible.</para>
129 <term><constant>KDBUS_MAKE_ACCESS_WORLD</constant></term>
131 <para>Make the endpoint file world-accessible.</para>
136 <term><constant>KDBUS_FLAG_NEGOTIATE</constant></term>
139 Requests a set of valid flags for this ioctl. When this bit is
140 set, no action is taken; the ioctl will return
141 <errorcode>0</errorcode>, and the <varname>flags</varname>
142 field will have all bits set that are valid for this command.
143 The <constant>KDBUS_FLAG_NEGOTIATE</constant> bit will be
144 cleared by the operation.
153 <term><varname>return_flags</varname></term>
155 Flags returned by the kernel. Currently unused and always set to
156 <constant>0</constant> by the kernel.
161 <term><varname>items</varname></term>
164 The following items are expected for
165 <constant>KDBUS_CMD_ENDPOINT_MAKE</constant>.
169 <term><constant>KDBUS_ITEM_MAKE_NAME</constant></term>
171 <para>Contains a string to identify the endpoint name.</para>
176 <term><constant>KDBUS_ITEM_NAME</constant></term>
177 <term><constant>KDBUS_ITEM_POLICY_ACCESS</constant></term>
180 These items are used to set the policy attached to the
181 endpoint. For more details on bus and endpoint policies, see
183 <refentrytitle>kdbus.policy</refentrytitle>
184 <manvolnum>7</manvolnum>
191 Unrecognized items are rejected, and the ioctl will fail with
192 <varname>errno</varname> set to <varname>EINVAL</varname>.
200 <title>Updating endpoints</title>
202 To update an existing endpoint, the
203 <constant>KDBUS_CMD_ENDPOINT_UPDATE</constant> command is used on the file
204 descriptor that was used to create the endpoint, using
205 <constant>KDBUS_CMD_ENDPOINT_MAKE</constant>. The only relevant detail of
206 the endpoint that can be updated is the policy. When the command is
207 employed, the policy of the endpoint is <emphasis>replaced</emphasis>
208 atomically with the new set of rules.
209 The command takes a <type>struct kdbus_cmd</type> argument.
216 struct kdbus_item items[0];
220 <para>The fields in this struct are described below.</para>
224 <term><varname>size</varname></term>
226 The overall size of the struct, including its items.
231 <term><varname>flags</varname></term>
233 Unused for this command.
234 <constant>KDBUS_FLAG_NEGOTIATE</constant> is accepted to probe for
235 valid flags. If set, the ioctl will return <errorcode>0</errorcode>,
236 and the <varname>flags</varname> field is set to
237 <constant>0</constant>.
242 <term><varname>return_flags</varname></term>
244 Flags returned by the kernel. Currently unused and always set to
245 <constant>0</constant> by the kernel.
250 <term><varname>items</varname></term>
253 The following items are expected for
254 <constant>KDBUS_CMD_ENDPOINT_UPDATE</constant>.
258 <term><constant>KDBUS_ITEM_NAME</constant></term>
259 <term><constant>KDBUS_ITEM_POLICY_ACCESS</constant></term>
262 These items are used to set the policy attached to the
263 endpoint. For more details on bus and endpoint policies, see
265 <refentrytitle>kdbus.policy</refentrytitle>
266 <manvolnum>7</manvolnum>
268 Existing policy is atomically replaced with the new rules
275 <term><constant>KDBUS_ITEM_NEGOTIATE</constant></term>
277 With this item, programs can <emphasis>probe</emphasis> the
278 kernel for known item types. See
280 <refentrytitle>kdbus.item</refentrytitle>
281 <manvolnum>7</manvolnum>
288 Unrecognized items are rejected, and the ioctl will fail with
289 <varname>errno</varname> set to <constant>EINVAL</constant>.
297 <title>Return value</title>
299 On success, all mentioned ioctl commands return <errorcode>0</errorcode>;
300 on error, <errorcode>-1</errorcode> is returned, and
301 <varname>errno</varname> is set to indicate the error.
302 If the issued ioctl is illegal for the file descriptor used,
303 <varname>errno</varname> will be set to <constant>ENOTTY</constant>.
308 <constant>KDBUS_CMD_ENDPOINT_MAKE</constant> may fail with the
314 <term><constant>EINVAL</constant></term>
316 The flags supplied in the <type>struct kdbus_cmd</type>
322 <term><constant>EINVAL</constant></term>
324 Illegal combination of <constant>KDBUS_ITEM_NAME</constant> and
325 <constant>KDBUS_ITEM_POLICY_ACCESS</constant> was provided.
330 <term><constant>EEXIST</constant></term>
332 An endpoint of that name already exists.
337 <term><constant>EPERM</constant></term>
339 The calling user is not privileged. See
341 <refentrytitle>kdbus</refentrytitle>
342 <manvolnum>7</manvolnum>
344 for information about privileged users.
352 <constant>KDBUS_CMD_ENDPOINT_UPDATE</constant> may fail with the
358 <term><constant>EINVAL</constant></term>
360 The flags supplied in <type>struct kdbus_cmd</type>
366 <term><constant>EINVAL</constant></term>
368 Illegal combination of <constant>KDBUS_ITEM_NAME</constant> and
369 <constant>KDBUS_ITEM_POLICY_ACCESS</constant> was provided.
377 <title>See Also</title>
378 <simplelist type="inline">
381 <refentrytitle>kdbus</refentrytitle>
382 <manvolnum>7</manvolnum>
387 <refentrytitle>kdbus.bus</refentrytitle>
388 <manvolnum>7</manvolnum>
393 <refentrytitle>kdbus.endpoint</refentrytitle>
394 <manvolnum>7</manvolnum>
399 <refentrytitle>kdbus.fs</refentrytitle>
400 <manvolnum>7</manvolnum>
405 <refentrytitle>kdbus.item</refentrytitle>
406 <manvolnum>7</manvolnum>
411 <refentrytitle>kdbus.message</refentrytitle>
412 <manvolnum>7</manvolnum>
417 <refentrytitle>kdbus.name</refentrytitle>
418 <manvolnum>7</manvolnum>
423 <refentrytitle>kdbus.pool</refentrytitle>
424 <manvolnum>7</manvolnum>