]>
Commit | Line | Data |
---|---|---|
3802a3d3 | 1 | <?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*--> |
effbc8e4 | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" |
12b42c76 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
effbc8e4 ZJS |
4 | |
5 | <!-- | |
572eb058 ZJS |
6 | SPDX-License-Identifier: LGPL-2.1+ |
7 | ||
5de0ccff | 8 | This file is part of systemd. |
effbc8e4 | 9 | |
5de0ccff | 10 | Copyright 2014 Zbigniew Jędrzejewski-Szmek |
effbc8e4 ZJS |
11 | --> |
12 | ||
48f69d8f | 13 | <refentry id="sd_bus_message_append_string_memfd" |
effbc8e4 ZJS |
14 | xmlns:xi="http://www.w3.org/2001/XInclude"> |
15 | ||
16 | <refentryinfo> | |
17 | <title>sd_bus_message_append_string_memfd</title> | |
18 | <productname>systemd</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 <systemd/sd-bus.h></funcsynopsisinfo> | |
46 | ||
47 | <funcprototype> | |
48 | <funcdef>int sd_bus_message_append_string_memfd</funcdef> | |
49 | <paramdef>sd_bus_message *<parameter>m</parameter></paramdef> | |
fac9c0d5 | 50 | <paramdef>int <parameter>memfd</parameter></paramdef> |
effbc8e4 ZJS |
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 | ||
b8bde116 | 72 | <para>The functions |
effbc8e4 ZJS |
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 | |
b8bde116 | 79 | <function>sd_bus_message_append_string_memfd</function>, the |
effbc8e4 ZJS |
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 | |
b8bde116 | 86 | <function>sd_bus_message_append_string_iovec</function>, the |
effbc8e4 ZJS |
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 | ||
b8bde116 | 92 | <para>The <parameter>iov</parameter> argument must point to |
effbc8e4 ZJS |
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 | ||
b8bde116 JE |
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 | |
effbc8e4 | 106 | type <literal>s</literal>, but instead of copying a string into |
dca348bc JE |
107 | the message, it returns a pointer to the destination area to |
108 | the caller in pointer <parameter>p</parameter>. Space for the string | |
effbc8e4 ZJS |
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 | <refsect1> | |
123 | <title>Notes</title> | |
124 | ||
b8bde116 | 125 | <para>The functions described here are available as a shared library, |
effbc8e4 | 126 | which can be compiled and linked to with the |
5aded369 | 127 | <constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
effbc8e4 ZJS |
128 | file.</para> |
129 | </refsect1> | |
130 | ||
131 | <refsect1> | |
132 | <title>See Also</title> | |
133 | ||
134 | <para> | |
135 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
136 | <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
137 | <citerefentry><refentrytitle>sd_bus_message_append_basic</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
138 | <ulink url="http://dbus.freedesktop.org/doc/dbus-specification.html">The D-Bus specification</ulink> | |
139 | </para> | |
140 | </refsect1> | |
141 | ||
142 | </refentry> |