| 1 |
<?xml version='1.0'?> |
| 2 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 3 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
| 4 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 5 |
|
| 6 |
<refentry id="sd_bus_message_append_string_memfd" |
| 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> |
| 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> |
| 34 |
<paramdef>int <parameter>memfd</parameter></paramdef> |
| 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 |
|
| 56 |
<para>The functions |
| 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 |
| 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> |
| 68 |
|
| 69 |
<para>In case of |
| 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> |
| 75 |
|
| 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> |
| 85 |
|
| 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 |
| 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> |
| 95 |
</refsect1> |
| 96 |
|
| 97 |
<refsect1> |
| 98 |
<title>Return Value</title> |
| 99 |
|
| 100 |
<para>On success, those calls return 0 or a positive integer. On failure, they return a negative |
| 101 |
errno-style error code.</para> |
| 102 |
|
| 103 |
<xi:include href="sd_bus_message_append_basic.xml" xpointer="errors" /> |
| 104 |
</refsect1> |
| 105 |
|
| 106 |
<xi:include href="libsystemd-pkgconfig.xml" /> |
| 107 |
|
| 108 |
<refsect1> |
| 109 |
<title>See Also</title> |
| 110 |
|
| 111 |
<para><simplelist type="inline"> |
| 112 |
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 113 |
<member><citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 114 |
<member><citerefentry><refentrytitle>sd_bus_message_append_basic</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> |
| 115 |
<member><ulink url="https://dbus.freedesktop.org/doc/dbus-specification.html">The D-Bus specification</ulink></member> |
| 116 |
</simplelist></para> |
| 117 |
</refsect1> |
| 118 |
|
| 119 |
</refentry> |