1 <?xml version='
1.0'
?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 SPDX-License-Identifier: LGPL-2.1+
8 Copyright 2014 Zbigniew Jędrzejewski-Szmek
11 <refentry id=
"sd_bus_message_append_string_memfd"
12 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
15 <title>sd_bus_message_append_string_memfd
</title>
16 <productname>systemd
</productname>
20 <contrib>A monkey with a typewriter
</contrib>
21 <firstname>Zbigniew
</firstname>
22 <surname>Jędrzejewski-Szmek
</surname>
23 <email>zbyszek@in.waw.pl
</email>
29 <refentrytitle>sd_bus_message_append_string_memfd
</refentrytitle>
30 <manvolnum>3</manvolnum>
34 <refname>sd_bus_message_append_string_memfd
</refname>
35 <refname>sd_bus_message_append_string_iovec
</refname>
36 <refname>sd_bus_message_append_string_space
</refname>
38 <refpurpose>Attach a string to a message
</refpurpose>
43 <funcsynopsisinfo>#include
<systemd/sd-bus.h
></funcsynopsisinfo>
46 <funcdef>int sd_bus_message_append_string_memfd
</funcdef>
47 <paramdef>sd_bus_message *
<parameter>m
</parameter></paramdef>
48 <paramdef>int
<parameter>memfd
</parameter></paramdef>
52 <funcdef>int sd_bus_message_append_string_iovec
</funcdef>
53 <paramdef>sd_bus_message *
<parameter>m
</parameter></paramdef>
54 <paramdef>const struct iovec *
<parameter>iov
</parameter></paramdef>
55 <paramdef>unsigned
<parameter>n
</parameter></paramdef>
59 <funcdef>int sd_bus_message_append_string_space
</funcdef>
60 <paramdef>sd_bus_message *
<parameter>m
</parameter></paramdef>
61 <paramdef>size_t
<parameter>size
</parameter></paramdef>
62 <paramdef>char **
<parameter>s
</parameter></paramdef>
68 <title>Description
</title>
71 <function>sd_bus_message_append_string_memfd
</function> and
72 <function>sd_bus_message_append_string_iovec
</function> can be
73 used to append a single string (item of type
<literal>s
</literal>)
74 to message
<parameter>m
</parameter>.
</para>
77 <function>sd_bus_message_append_string_memfd
</function>, the
78 contents of
<parameter>memfd
</parameter> are the string. They must
79 satisfy the same constraints as described for the
80 <literal>s
</literal> type in
81 <citerefentry><refentrytitle>sd_bus_message_append_basic
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
</para>
84 <function>sd_bus_message_append_string_iovec
</function>, the
85 payload of
<parameter>iov
</parameter> is the string. It must
86 satisfy the same constraints as described for the
87 <literal>s
</literal> type in
88 <citerefentry><refentrytitle>sd_bus_message_append_basic
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
</para>
90 <para>The
<parameter>iov
</parameter> argument must point to
91 <parameter>n
</parameter> <structname>struct iovec
</structname>
92 structures. Each structure may have the
93 <structname>iov_base
</structname> field set, in which case the
94 memory pointed to will be copied into the message, or unset, in
95 which case a block of spaces (ASCII
32) of length
96 <structname>iov_len
</structname> will be inserted. The
97 memory pointed at by
<parameter>iov
</parameter> may be changed
98 after this call.
</para>
101 <function>sd_bus_message_append_string_space
</function> function appends
102 space for a string to message
<parameter>m
</parameter>. It behaves
103 similar to
<function>sd_bus_message_append_basic
</function> with
104 type
<literal>s
</literal>, but instead of copying a string into
105 the message, it returns a pointer to the destination area to
106 the caller in pointer
<parameter>p
</parameter>. Space for the string
107 of length
<parameter>size
</parameter> plus the terminating
108 <constant>NUL
</constant> is allocated.
</para>
112 <title>Return Value
</title>
114 <para>On success, those calls return
0 or a positive integer. On
115 failure, they returns a negative errno-style error code.
</para>
118 <xi:include href=
"sd_bus_message_append_basic.xml" xpointer=
"errors" />
120 <xi:include href=
"libsystemd-pkgconfig.xml" />
123 <title>See Also
</title>
126 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
127 <citerefentry><refentrytitle>sd-bus
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
128 <citerefentry><refentrytitle>sd_bus_message_append_basic
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
129 <ulink url=
"http://dbus.freedesktop.org/doc/dbus-specification.html">The D-Bus specification
</ulink>