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 This file is part of elogind.
7 SPDX-License-Identifier: LGPL-2.1+
10 Copyright 2014 Zbigniew Jędrzejewski-Szmek
13 <refentry id="sd_bus_message_append_string_memfd"
14 xmlns:xi="http://www.w3.org/2001/XInclude">
17 <title>sd_bus_message_append_string_memfd</title>
18 <productname>elogind</productname>
22 <contrib>A monkey with a typewriter</contrib>
23 <firstname>Zbigniew</firstname>
24 <surname>Jędrzejewski-Szmek</surname>
25 <email>zbyszek@in.waw.pl</email>
31 <refentrytitle>sd_bus_message_append_string_memfd</refentrytitle>
32 <manvolnum>3</manvolnum>
36 <refname>sd_bus_message_append_string_memfd</refname>
37 <refname>sd_bus_message_append_string_iovec</refname>
38 <refname>sd_bus_message_append_string_space</refname>
40 <refpurpose>Attach a string to a message</refpurpose>
45 <funcsynopsisinfo>#include <elogind/sd-bus.h></funcsynopsisinfo>
48 <funcdef>int sd_bus_message_append_string_memfd</funcdef>
49 <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
50 <paramdef>int <parameter>memfd</parameter></paramdef>
54 <funcdef>int sd_bus_message_append_string_iovec</funcdef>
55 <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
56 <paramdef>const struct iovec *<parameter>iov</parameter></paramdef>
57 <paramdef>unsigned <parameter>n</parameter></paramdef>
61 <funcdef>int sd_bus_message_append_string_space</funcdef>
62 <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
63 <paramdef>size_t <parameter>size</parameter></paramdef>
64 <paramdef>char **<parameter>s</parameter></paramdef>
70 <title>Description</title>
73 <function>sd_bus_message_append_string_memfd</function> and
74 <function>sd_bus_message_append_string_iovec</function> can be
75 used to append a single string (item of type <literal>s</literal>)
76 to message <parameter>m</parameter>.</para>
79 <function>sd_bus_message_append_string_memfd</function>, the
80 contents of <parameter>memfd</parameter> are the string. They must
81 satisfy the same constraints as described for the
82 <literal>s</literal> type in
83 <citerefentry><refentrytitle>sd_bus_message_append_basic</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
86 <function>sd_bus_message_append_string_iovec</function>, the
87 payload of <parameter>iov</parameter> is the string. It must
88 satisfy the same constraints as described for the
89 <literal>s</literal> type in
90 <citerefentry><refentrytitle>sd_bus_message_append_basic</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
92 <para>The <parameter>iov</parameter> argument must point to
93 <parameter>n</parameter> <structname>struct iovec</structname>
94 structures. Each structure may have the
95 <structname>iov_base</structname> field set, in which case the
96 memory pointed to will be copied into the message, or unset, in
97 which case a block of spaces (ASCII 32) of length
98 <structname>iov_len</structname> will be inserted. The
99 memory pointed at by <parameter>iov</parameter> may be changed
100 after this call.</para>
103 <function>sd_bus_message_append_string_space</function> function appends
104 space for a string to message <parameter>m</parameter>. It behaves
105 similar to <function>sd_bus_message_append_basic</function> with
106 type <literal>s</literal>, but instead of copying a string into
107 the message, it returns a pointer to the destination area to
108 the caller in pointer <parameter>p</parameter>. Space for the string
109 of length <parameter>size</parameter> plus the terminating
110 <constant>NUL</constant> is allocated.</para>
114 <title>Return Value</title>
116 <para>On success, those calls return 0 or a positive integer. On
117 failure, they returns a negative errno-style error code.</para>
120 <xi:include href="sd_bus_message_append_basic.xml" xpointer="errors" />
125 <para>The functions described here are available as a shared library,
126 which can be compiled and linked to with the
127 <constant>libelogind</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
132 <title>See Also</title>
135 <!-- 0 /// elogind is in section 8
136 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
138 <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
140 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
141 <citerefentry><refentrytitle>sd_bus_message_append_basic</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
142 <ulink url="http://dbus.freedesktop.org/doc/dbus-specification.html">The D-Bus specification</ulink>