chiark / gitweb /
88da2a7a4368f92bfd36578533eb1567bdfe00f8
[elogind.git] / man / sd_bus_message_append_string_memfd.xml
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">
4
5 <!--
6   This file is part of elogind.
7   SPDX-License-Identifier: LGPL-2.1+
8
9
10   Copyright 2014 Zbigniew JÄ™drzejewski-Szmek
11 -->
12
13 <refentry id="sd_bus_message_append_string_memfd"
14           xmlns:xi="http://www.w3.org/2001/XInclude">
15
16   <refentryinfo>
17     <title>sd_bus_message_append_string_memfd</title>
18     <productname>elogind</productname>
19
20     <authorgroup>
21       <author>
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>
26       </author>
27     </authorgroup>
28   </refentryinfo>
29
30   <refmeta>
31     <refentrytitle>sd_bus_message_append_string_memfd</refentrytitle>
32     <manvolnum>3</manvolnum>
33   </refmeta>
34
35   <refnamediv>
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>
39
40     <refpurpose>Attach a string to a message</refpurpose>
41   </refnamediv>
42
43   <refsynopsisdiv>
44     <funcsynopsis>
45       <funcsynopsisinfo>#include &lt;elogind/sd-bus.h&gt;</funcsynopsisinfo>
46
47       <funcprototype>
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>
51       </funcprototype>
52
53       <funcprototype>
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>
58       </funcprototype>
59
60       <funcprototype>
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>
65       </funcprototype>
66     </funcsynopsis>
67   </refsynopsisdiv>
68
69   <refsect1>
70     <title>Description</title>
71
72     <para>The functions
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>
77
78     <para>In case of
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>
84
85     <para>In case of
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>
91
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>
101
102     <para>The
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>
111   </refsect1>
112
113   <refsect1>
114     <title>Return Value</title>
115
116     <para>On success, those calls return 0 or a positive integer. On
117     failure, they returns a negative errno-style error code.</para>
118   </refsect1>
119
120   <xi:include href="sd_bus_message_append_basic.xml" xpointer="errors" />
121
122   <xi:include href="libelogind-pkgconfig.xml" />
123
124   <refsect1>
125     <title>See Also</title>
126
127     <para>
128       <!-- 0 /// elogind is in section 8
129       <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
130       --><!-- else -->
131       <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
132       <!-- // 0 -->
133       <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
134       <citerefentry><refentrytitle>sd_bus_message_append_basic</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
135       <ulink url="http://dbus.freedesktop.org/doc/dbus-specification.html">The D-Bus specification</ulink>
136     </para>
137   </refsect1>
138
139 </refentry>