]>
Commit | Line | Data |
---|---|---|
514094f9 | 1 | <?xml version='1.0'?> |
3a54a157 ZJS |
2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> | |
0307f791 | 4 | <!-- SPDX-License-Identifier: LGPL-2.1+ --> |
effbc8e4 | 5 | |
48f69d8f | 6 | <refentry id="sd_bus_message_append_string_memfd" |
effbc8e4 ZJS |
7 | xmlns:xi="http://www.w3.org/2001/XInclude"> |
8 | ||
9 | <refentryinfo> | |
10 | <title>sd_bus_message_append_string_memfd</title> | |
11 | <productname>systemd</productname> | |
effbc8e4 ZJS |
12 | </refentryinfo> |
13 | ||
14 | <refmeta> | |
15 | <refentrytitle>sd_bus_message_append_string_memfd</refentrytitle> | |
16 | <manvolnum>3</manvolnum> | |
17 | </refmeta> | |
18 | ||
19 | <refnamediv> | |
20 | <refname>sd_bus_message_append_string_memfd</refname> | |
21 | <refname>sd_bus_message_append_string_iovec</refname> | |
22 | <refname>sd_bus_message_append_string_space</refname> | |
23 | ||
24 | <refpurpose>Attach a string to a message</refpurpose> | |
25 | </refnamediv> | |
26 | ||
27 | <refsynopsisdiv> | |
28 | <funcsynopsis> | |
29 | <funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo> | |
30 | ||
31 | <funcprototype> | |
32 | <funcdef>int sd_bus_message_append_string_memfd</funcdef> | |
33 | <paramdef>sd_bus_message *<parameter>m</parameter></paramdef> | |
fac9c0d5 | 34 | <paramdef>int <parameter>memfd</parameter></paramdef> |
effbc8e4 ZJS |
35 | </funcprototype> |
36 | ||
37 | <funcprototype> | |
38 | <funcdef>int sd_bus_message_append_string_iovec</funcdef> | |
39 | <paramdef>sd_bus_message *<parameter>m</parameter></paramdef> | |
40 | <paramdef>const struct iovec *<parameter>iov</parameter></paramdef> | |
41 | <paramdef>unsigned <parameter>n</parameter></paramdef> | |
42 | </funcprototype> | |
43 | ||
44 | <funcprototype> | |
45 | <funcdef>int sd_bus_message_append_string_space</funcdef> | |
46 | <paramdef>sd_bus_message *<parameter>m</parameter></paramdef> | |
47 | <paramdef>size_t <parameter>size</parameter></paramdef> | |
48 | <paramdef>char **<parameter>s</parameter></paramdef> | |
49 | </funcprototype> | |
50 | </funcsynopsis> | |
51 | </refsynopsisdiv> | |
52 | ||
53 | <refsect1> | |
54 | <title>Description</title> | |
55 | ||
b8bde116 | 56 | <para>The functions |
effbc8e4 ZJS |
57 | <function>sd_bus_message_append_string_memfd</function> and |
58 | <function>sd_bus_message_append_string_iovec</function> can be | |
59 | used to append a single string (item of type <literal>s</literal>) | |
60 | to message <parameter>m</parameter>.</para> | |
61 | ||
62 | <para>In case of | |
b8bde116 | 63 | <function>sd_bus_message_append_string_memfd</function>, the |
effbc8e4 ZJS |
64 | contents of <parameter>memfd</parameter> are the string. They must |
65 | satisfy the same constraints as described for the | |
66 | <literal>s</literal> type in | |
67 | <citerefentry><refentrytitle>sd_bus_message_append_basic</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para> | |
68 | ||
69 | <para>In case of | |
b8bde116 | 70 | <function>sd_bus_message_append_string_iovec</function>, the |
effbc8e4 ZJS |
71 | payload of <parameter>iov</parameter> is the string. It must |
72 | satisfy the same constraints as described for the | |
73 | <literal>s</literal> type in | |
74 | <citerefentry><refentrytitle>sd_bus_message_append_basic</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para> | |
75 | ||
b8bde116 | 76 | <para>The <parameter>iov</parameter> argument must point to |
effbc8e4 ZJS |
77 | <parameter>n</parameter> <structname>struct iovec</structname> |
78 | structures. Each structure may have the | |
79 | <structname>iov_base</structname> field set, in which case the | |
80 | memory pointed to will be copied into the message, or unset, in | |
81 | which case a block of spaces (ASCII 32) of length | |
82 | <structname>iov_len</structname> will be inserted. The | |
83 | memory pointed at by <parameter>iov</parameter> may be changed | |
84 | after this call.</para> | |
85 | ||
b8bde116 JE |
86 | <para>The |
87 | <function>sd_bus_message_append_string_space</function> function appends | |
88 | space for a string to message <parameter>m</parameter>. It behaves | |
89 | similar to <function>sd_bus_message_append_basic</function> with | |
effbc8e4 | 90 | type <literal>s</literal>, but instead of copying a string into |
dca348bc JE |
91 | the message, it returns a pointer to the destination area to |
92 | the caller in pointer <parameter>p</parameter>. Space for the string | |
effbc8e4 ZJS |
93 | of length <parameter>size</parameter> plus the terminating |
94 | <constant>NUL</constant> is allocated.</para> | |
95 | </refsect1> | |
96 | ||
97 | <refsect1> | |
98 | <title>Return Value</title> | |
99 | ||
b1de39de ZJS |
100 | <para>On success, those calls return 0 or a positive integer. On failure, they return a negative |
101 | errno-style error code.</para> | |
effbc8e4 | 102 | |
b1de39de ZJS |
103 | <xi:include href="sd_bus_message_append_basic.xml" xpointer="errors" /> |
104 | </refsect1> | |
effbc8e4 | 105 | |
7d6b2723 | 106 | <xi:include href="libsystemd-pkgconfig.xml" /> |
effbc8e4 ZJS |
107 | |
108 | <refsect1> | |
109 | <title>See Also</title> | |
110 | ||
111 | <para> | |
112 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
113 | <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
114 | <citerefentry><refentrytitle>sd_bus_message_append_basic</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
115 | <ulink url="http://dbus.freedesktop.org/doc/dbus-specification.html">The D-Bus specification</ulink> | |
116 | </para> | |
117 | </refsect1> | |
118 | ||
119 | </refentry> |