2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
6 <refentry id="sd_bus_message_copy" xmlns:xi="http://www.w3.org/2001/XInclude">
9 <title>sd_bus_message_copy</title>
10 <productname>systemd</productname>
14 <refentrytitle>sd_bus_message_copy</refentrytitle>
15 <manvolnum>3</manvolnum>
19 <refname>sd_bus_message_copy</refname>
21 <refpurpose>Copy the contents of one message to another</refpurpose>
26 <funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo>
29 <funcdef>int sd_bus_message_copy</funcdef>
30 <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
31 <paramdef>sd_bus_message *<parameter>source</parameter></paramdef>
32 <paramdef>int <parameter>all</parameter></paramdef>
38 <title>Description</title>
40 <para><function>sd_bus_message_copy()</function> copies the contents from
41 message <parameter>source</parameter> to <parameter>m</parameter>. If
42 <parameter>all</parameter> is false, a single complete type is copied
43 (basic or container). If <parameter>all</parameter> is true, the contents
44 are copied until the end of the currently open container or the end
45 of <parameter>source</parameter>.</para>
49 <title>Return Value</title>
51 <para>On success, this call returns true if anything was copied, and false if
52 there was nothing to copy. On failure, it returns a negative errno-style error
55 <refsect2 id='errors'>
58 <para>Returned errors may indicate the following problems:</para>
63 <term><constant>-EINVAL</constant></term>
65 <listitem><para><parameter>source</parameter> or <parameter>m</parameter> are
66 <constant>NULL</constant>.</para></listitem>
70 <term><constant>-EPERM</constant></term>
72 <listitem><para>Message <parameter>m</parameter> has been sealed or <parameter>source</parameter>
73 has <emphasis>not</emphasis> been sealed. </para></listitem>
77 <term><constant>-ESTALE</constant></term>
79 <listitem><para>Destination message is in invalid state.
84 <term><constant>-ENXIO</constant></term>
86 <listitem><para>Destination message cannot be appended to.
91 <term><constant>-ENOMEM</constant></term>
93 <listitem><para>Memory allocation failed.</para></listitem>
99 <xi:include href="libsystemd-pkgconfig.xml" />
102 <title>See Also</title>
105 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
106 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
107 <citerefentry><refentrytitle>sd_bus_message_append</refentrytitle><manvolnum>3</manvolnum></citerefentry>