]>
Commit | Line | Data |
---|---|---|
60f067b4 JS |
1 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>sd_bus_message_append_string_memfd</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style> |
2 | a.headerlink { | |
3 | color: #c60f0f; | |
4 | font-size: 0.8em; | |
5 | padding: 0 4px 0 4px; | |
6 | text-decoration: none; | |
7 | visibility: hidden; | |
8 | } | |
9 | ||
10 | a.headerlink:hover { | |
11 | background-color: #c60f0f; | |
12 | color: white; | |
13 | } | |
14 | ||
15 | h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink { | |
16 | visibility: visible; | |
17 | } | |
18 | </style><a href="index.html">Index </a>· | |
19 | <a href="systemd.directives.html">Directives </a>· | |
20 | <a href="../python-systemd/index.html">Python </a>· | |
21 | <a href="../libudev/index.html">libudev </a>· | |
e735f4d4 | 22 | <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 219</span><hr><div class="refentry"><a name="sd_bus_message_append_string_memfd"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>sd_bus_message_append_string_memfd, sd_bus_message_append_string_iovec, sd_bus_message_append_string_space — Attach a string to a message</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <systemd/sd-bus.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int sd_bus_message_append_string_memfd(</code></td><td>sd_bus_message *<var class="pdparam">m</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">memfd</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int sd_bus_message_append_string_iovec(</code></td><td>sd_bus_message *<var class="pdparam">m</var>, </td></tr><tr><td> </td><td>const struct iovec *<var class="pdparam">iov</var>, </td></tr><tr><td> </td><td>unsigned <var class="pdparam">n</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int sd_bus_message_append_string_space(</code></td><td>sd_bus_message *<var class="pdparam">m</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">size</var>, </td></tr><tr><td> </td><td>char **<var class="pdparam">s</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idm140400234711504"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description">¶</a></h2><p>The functions |
60f067b4 JS |
23 | <code class="function">sd_bus_message_append_string_memfd</code> and |
24 | <code class="function">sd_bus_message_append_string_iovec</code> can be | |
25 | used to append a single string (item of type "<code class="literal">s</code>") | |
26 | to message <em class="parameter"><code>m</code></em>.</p><p>In case of | |
27 | <code class="function">sd_bus_message_append_string_memfd</code>, the | |
28 | contents of <em class="parameter"><code>memfd</code></em> are the string. They must | |
29 | satisfy the same constraints as described for the | |
30 | "<code class="literal">s</code>" type in | |
31 | <a href="sd_bus_message_append_basic.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_message_append_basic</span>(3)</span></a>.</p><p>In case of | |
32 | <code class="function">sd_bus_message_append_string_iovec</code>, the | |
33 | payload of <em class="parameter"><code>iov</code></em> is the string. It must | |
34 | satisfy the same constraints as described for the | |
35 | "<code class="literal">s</code>" type in | |
36 | <a href="sd_bus_message_append_basic.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_message_append_basic</span>(3)</span></a>.</p><p>The <em class="parameter"><code>iov</code></em> argument must point to | |
37 | <em class="parameter"><code>n</code></em> <span class="structname">struct iovec</span> | |
38 | structures. Each structure may have the | |
39 | <span class="structname">iov_base</span> field set, in which case the | |
40 | memory pointed to will be copied into the message, or unset, in | |
41 | which case a block of spaces (ASCII 32) of length | |
42 | <span class="structname">iov_len</span> will be inserted. The | |
43 | memory pointed at by <em class="parameter"><code>iov</code></em> may be changed | |
44 | after this call.</p><p>The | |
45 | <code class="function">sd_bus_message_append_string_space</code> function appends | |
46 | space for a string to message <em class="parameter"><code>m</code></em>. It behaves | |
47 | similar to <code class="function">sd_bus_message_append_basic</code> with | |
48 | type "<code class="literal">s</code>", but instead of copying a string into | |
49 | the message, it returns a pointer to the destination area to | |
50 | the caller in pointer <em class="parameter"><code>p</code></em>. Space for the string | |
51 | of length <em class="parameter"><code>size</code></em> plus the terminating | |
e735f4d4 | 52 | <code class="constant">NUL</code> is allocated.</p></div><div class="refsect1"><a name="idm140400238594560"></a><h2 id="Return Value">Return Value<a class="headerlink" title="Permalink to this headline" href="#Return%20Value">¶</a></h2><p>On success, those calls return 0 or a positive integer. On |
5eef597e MP |
53 | failure, they returns a negative errno-style error code.</p></div><div class="refsect1"><a name="errors"></a><h2 id="Errors">Errors<a class="headerlink" title="Permalink to this headline" href="#Errors">¶</a></h2><p>Returned errors may indicate the following problems:</p><div class="variablelist"><dl class="variablelist"><dt id="-EINVAL"><span class="term"><code class="constant">-EINVAL</code></span><a class="headerlink" title="Permalink to this term" href="#-EINVAL">¶</a></dt><dd><p>Specified parameter is invalid. |
54 | </p></dd><dt id="-EPERM"><span class="term"><code class="constant">-EPERM</code></span><a class="headerlink" title="Permalink to this term" href="#-EPERM">¶</a></dt><dd><p>Message has been sealed. | |
55 | </p></dd><dt id="-ESTALE"><span class="term"><code class="constant">-ESTALE</code></span><a class="headerlink" title="Permalink to this term" href="#-ESTALE">¶</a></dt><dd><p>Message is in invalid state. | |
56 | </p></dd><dt id="-ENXIO"><span class="term"><code class="constant">-ENXIO</code></span><a class="headerlink" title="Permalink to this term" href="#-ENXIO">¶</a></dt><dd><p>Message cannot be appended to. | |
e735f4d4 | 57 | </p></dd><dt id="-ENOMEM"><span class="term"><code class="constant">-ENOMEM</code></span><a class="headerlink" title="Permalink to this term" href="#-ENOMEM">¶</a></dt><dd><p>Memory allocation failed.</p></dd></dl></div></div><div class="refsect1"><a name="idm140400238585024"></a><h2 id="Notes">Notes<a class="headerlink" title="Permalink to this headline" href="#Notes">¶</a></h2><p>The functions described here are available as a shared library, |
60f067b4 | 58 | which can be compiled and linked to with the |
5eef597e | 59 | <code class="constant">libsystemd</code> <a href="http://linux.die.net/man/1/pkg-config"><span class="citerefentry"><span class="refentrytitle">pkg-config</span>(1)</span></a> |
e735f4d4 | 60 | file.</p></div><div class="refsect1"><a name="idm140400238582112"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also">¶</a></h2><p> |
60f067b4 JS |
61 | <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>, |
62 | <a href="sd-bus.html"><span class="citerefentry"><span class="refentrytitle">sd-bus</span>(3)</span></a>, | |
63 | <a href="sd_bus_message_append_basic.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_message_append_basic</span>(3)</span></a>, | |
64 | <a class="ulink" href="http://dbus.freedesktop.org/doc/dbus-specification.html" target="_top">The D-Bus specification</a> | |
65 | </p></div></div></body></html> |