]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/sd_bus_message_append_array.xml
namespace: implicitly adds DeviceAllow= when RootImage= is set
[thirdparty/systemd.git] / man / sd_bus_message_append_array.xml
CommitLineData
514094f9 1<?xml version='1.0'?>
effbc8e4 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
12b42c76 3"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
effbc8e4
ZJS
4
5<!--
572eb058 6 SPDX-License-Identifier: LGPL-2.1+
effbc8e4
ZJS
7-->
8
48f69d8f 9<refentry id="sd_bus_message_append_array"
effbc8e4
ZJS
10 xmlns:xi="http://www.w3.org/2001/XInclude">
11
12 <refentryinfo>
13 <title>sd_bus_message_append_array</title>
14 <productname>systemd</productname>
effbc8e4
ZJS
15 </refentryinfo>
16
17 <refmeta>
18 <refentrytitle>sd_bus_message_append_array</refentrytitle>
19 <manvolnum>3</manvolnum>
20 </refmeta>
21
22 <refnamediv>
23 <refname>sd_bus_message_append_array</refname>
24 <refname>sd_bus_message_append_array_memfd</refname>
25 <refname>sd_bus_message_append_array_iovec</refname>
26 <refname>sd_bus_message_append_array_space</refname>
27
dd2b607b 28 <refpurpose>Append an array of fields to a D-Bus
e8216945 29 message</refpurpose>
effbc8e4
ZJS
30 </refnamediv>
31
32 <refsynopsisdiv>
33 <funcsynopsis>
34 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
35
36 <funcprototype>
37 <funcdef>int sd_bus_message_append_array</funcdef>
38 <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
39 <paramdef>char <parameter>type</parameter></paramdef>
40 <paramdef>char void *<parameter>ptr</parameter></paramdef>
41 <paramdef>size_t <parameter>size</parameter></paramdef>
42 </funcprototype>
43
44 <funcprototype>
45 <funcdef>int sd_bus_message_append_array_memfd</funcdef>
46 <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
47 <paramdef>char <parameter>type</parameter></paramdef>
fac9c0d5 48 <paramdef>int <parameter>memfd</parameter></paramdef>
e8216945
LP
49 <paramdef>uint64_t <parameter>offset</parameter></paramdef>
50 <paramdef>uint64_t <parameter>size</parameter></paramdef>
effbc8e4
ZJS
51 </funcprototype>
52
53 <funcprototype>
54 <funcdef>int sd_bus_message_append_array_iovec</funcdef>
55 <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
56 <paramdef>char <parameter>type</parameter></paramdef>
57 <paramdef>const struct iovec *<parameter>iov</parameter></paramdef>
58 <paramdef>unsigned <parameter>n</parameter></paramdef>
59 </funcprototype>
60
61 <funcprototype>
62 <funcdef>int sd_bus_message_append_array_space</funcdef>
63 <paramdef>char <parameter>type</parameter></paramdef>
64 <paramdef>size_t <parameter>size</parameter></paramdef>
e8216945 65 <paramdef>void **<parameter>ptr</parameter></paramdef>
effbc8e4
ZJS
66 </funcprototype>
67 </funcsynopsis>
68 </refsynopsisdiv>
69
70 <refsect1>
71 <title>Description</title>
72
e8216945
LP
73 <para>The <function>sd_bus_message_append_array()</function>
74 function appends an array to a D-Bus message
75 <parameter>m</parameter>. A container will be opened, the array
76 contents appended, and the container closed. The parameter
77 <parameter>type</parameter> determines how the pointer
78 <parameter>p</parameter> is interpreted.
effbc8e4
ZJS
79 <parameter>type</parameter> must be one of the "trivial" types
80 <literal>y</literal>, <literal>n</literal>, <literal>q</literal>,
81 <literal>i</literal>, <literal>u</literal>, <literal>x</literal>,
82 <literal>t</literal>, <literal>d</literal> (but not
e8216945
LP
83 <literal>b</literal>), as defined by the <ulink
84 url="http://dbus.freedesktop.org/doc/dbus-specification.html#basic-types">Basic
85 Types</ulink> section of the D-Bus specification, and listed in
effbc8e4 86 <citerefentry><refentrytitle>sd_bus_message_append_basic</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
cbfaff65 87 Pointer <parameter>p</parameter> must point to an array of size
effbc8e4
ZJS
88 <parameter>size</parameter> bytes containing items of the
89 respective type. Size <parameter>size</parameter> must be a
90 multiple of the size of the type <parameter>type</parameter>. As a
91 special case, <parameter>p</parameter> may be
92 <constant>NULL</constant>, if <parameter>size</parameter> is 0.
e8216945
LP
93 The memory pointed to by <parameter>p</parameter> is copied into
94 the memory area containing the message and stays in possession of
95 the caller. The caller may hence freely change the data after this
96 call without affecting the message the array was appended
97 to.</para>
98
99 <para>The <function>sd_bus_message_append_array_memfd()</function>
100 function appends an array of a trivial type to message
101 <parameter>m</parameter>, similar to
102 <function>sd_bus_message_append_array()</function>. The contents
103 of the memory file descriptor <parameter>memfd</parameter>
dd2b607b 104 starting at the specified offset and of the specified size is
e8216945
LP
105 used as the contents of the array. The offset and size must be a
106 multiple of the size of the type
107 <parameter>type</parameter>. However, as a special exception, if
108 the offset is specified as zero and the size specified as
109 UINT64_MAX the full memory file descriptor contents is used. The
7ca41557 110 memory file descriptor is sealed by this call if it has not been
a8eaaee7 111 sealed yet, and cannot be modified after this call. See
e8216945
LP
112 <citerefentry
113 project='man-pages'><refentrytitle>memfd_create</refentrytitle><manvolnum>2</manvolnum></citerefentry>
114 for details about memory file descriptors. Appending arrays with
115 memory file descriptors enables efficient zero-copy data transfer,
116 as the memory file descriptor may be passed as-is to the
117 destination, without copying the memory in it to the destination
118 process. Not all protocol transports support passing memory file
119 descriptors between participants, in which case this call will
120 automatically fall back to copying. Also, as memory file
b938cb90 121 descriptor passing is inefficient for smaller amounts of data,
e8216945
LP
122 copying might still be enforced even where memory file descriptor
123 passing is supported.</para>
124
125 <para>The <function>sd_bus_message_append_array_iovec()</function>
126 function appends an array of a trivial type to the message
127 <parameter>m</parameter>, similar to
128 <function>sd_bus_message_append_array()</function>. Contents of
b938cb90 129 the I/O vector array <parameter>iov</parameter> are used as the
e8216945
LP
130 contents of the array. The total size of
131 <parameter>iov</parameter> payload (the sum of
132 <structfield>iov_len</structfield> fields) must be a multiple of
133 the size of the type <parameter>type</parameter>. The
134 <parameter>iov</parameter> argument must point to
b938cb90 135 <parameter>n</parameter> I/O vector structures. Each structure may
e8216945
LP
136 have the <structname>iov_base</structname> field set, in which
137 case the memory pointed to will be copied into the message, or
138 unset (set to zero), in which case a block of zeros of length
effbc8e4
ZJS
139 <structname>iov_len</structname> bytes will be inserted. The
140 memory pointed at by <parameter>iov</parameter> may be changed
141 after this call.</para>
142
e8216945
LP
143 <para>The <function>sd_bus_message_append_array_space()</function>
144 function appends space for an array of a trivial type to message
145 <parameter>m</parameter>. It behaves the same as
146 <function>sd_bus_message_append_array()</function>, but instead of
147 copying items to the message, it returns a pointer to the
148 destination area to the caller in pointer
149 <parameter>p</parameter>. The caller should subsequently write the
a8eaaee7 150 array contents to this memory. Modifications to the memory
e8216945 151 pointed to should only occur until the next operation on the bus
b938cb90 152 message is invoked. Most importantly, the memory should not be
e8216945
LP
153 altered anymore when another field has been added to the message
154 or the message has been sealed.</para>
effbc8e4
ZJS
155 </refsect1>
156
157 <refsect1>
158 <title>Return Value</title>
159
b8bde116 160 <para>On success, these calls return 0 or a positive integer. On
dd2b607b 161 failure, they return a negative errno-style error code.</para>
effbc8e4
ZJS
162 </refsect1>
163
164 <xi:include href="sd_bus_message_append_basic.xml" xpointer="errors" />
165
7d6b2723 166 <xi:include href="libsystemd-pkgconfig.xml" />
effbc8e4
ZJS
167
168 <refsect1>
169 <title>See Also</title>
170
171 <para>
172 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
173 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
174 <citerefentry><refentrytitle>sd_bus_message_append</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
175 <citerefentry><refentrytitle>sd_bus_message_append_basic</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
e8216945 176 <citerefentry project='man-pages'><refentrytitle>memfd_create</refentrytitle><manvolnum>2</manvolnum></citerefentry>,
effbc8e4
ZJS
177 <ulink url="http://dbus.freedesktop.org/doc/dbus-specification.html">The D-Bus specification</ulink>
178 </para>
179 </refsect1>
180
181</refentry>