2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
6 <refentry id="sd_bus_message_append_string_memfd"
7 xmlns:xi="http://www.w3.org/2001/XInclude">
10 <title>sd_bus_message_append_string_memfd</title>
11 <productname>systemd</productname>
15 <refentrytitle>sd_bus_message_append_string_memfd</refentrytitle>
16 <manvolnum>3</manvolnum>
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>
24 <refpurpose>Attach a string to a message</refpurpose>
29 <funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo>
32 <funcdef>int sd_bus_message_append_string_memfd</funcdef>
33 <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
34 <paramdef>int <parameter>memfd</parameter></paramdef>
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>
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>
54 <title>Description</title>
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>
63 <function>sd_bus_message_append_string_memfd()</function>, the
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>
70 <function>sd_bus_message_append_string_iovec()</function>, the
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>
76 <para>The <parameter>iov</parameter> argument must point to
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>
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
90 type <literal>s</literal>, but instead of copying a string into
91 the message, it returns a pointer to the destination area to
92 the caller in pointer <parameter>p</parameter>. Space for the string
93 of length <parameter>size</parameter> plus the terminating
94 <constant>NUL</constant> is allocated.</para>
98 <title>Return Value</title>
100 <para>On success, those calls return 0 or a positive integer. On failure, they return a negative
101 errno-style error code.</para>
103 <xi:include href="sd_bus_message_append_basic.xml" xpointer="errors" />
106 <xi:include href="libsystemd-pkgconfig.xml" />
109 <title>See Also</title>
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="https://dbus.freedesktop.org/doc/dbus-specification.html">The D-Bus specification</ulink>