]>
Commit | Line | Data |
---|---|---|
b0f4c02e DDM |
1 | <?xml version='1.0'?> |
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+ --> | |
5 | ||
6 | <refentry id="sd_bus_send" | |
7 | xmlns:xi="http://www.w3.org/2001/XInclude"> | |
8 | ||
9 | <refentryinfo> | |
10 | <title>sd_bus_send</title> | |
11 | <productname>systemd</productname> | |
12 | </refentryinfo> | |
13 | ||
14 | <refmeta> | |
15 | <refentrytitle>sd_bus_send</refentrytitle> | |
16 | <manvolnum>3</manvolnum> | |
17 | </refmeta> | |
18 | ||
19 | <refnamediv> | |
20 | <refname>sd_bus_send</refname> | |
21 | ||
22 | <refpurpose>Queue a D-Bus message for transfer</refpurpose> | |
23 | </refnamediv> | |
24 | ||
25 | <refsynopsisdiv> | |
26 | <funcsynopsis> | |
27 | <funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo> | |
28 | ||
29 | <funcprototype> | |
30 | <funcdef>int <function>sd_bus_send</function></funcdef> | |
31 | <paramdef>sd_bus *<parameter>bus</parameter></paramdef> | |
32 | <paramdef>sd_bus_message *<parameter>m</parameter></paramdef> | |
33 | <paramdef>uint64_t *<parameter>cookie</parameter></paramdef> | |
34 | </funcprototype> | |
35 | </funcsynopsis> | |
36 | </refsynopsisdiv> | |
37 | ||
38 | <refsect1> | |
39 | <title>Description</title> | |
40 | ||
41 | <para><function>sd_bus_send()</function> queues the bus message object <parameter>m</parameter> | |
42 | for transfer. If <parameter>bus</parameter> is <constant>NULL</constant>, the bus that | |
43 | <parameter>m</parameter> is attached to is used. <parameter>bus</parameter> only needs to be set | |
44 | when the message is sent to a different bus than the one it's attached to, for example when | |
45 | forwarding messages. If the output parameter <parameter>cookie</parameter> is not | |
46 | <constant>NULL</constant>, it is set to the message identifier. This value can later be used to | |
47 | match incoming replies to their corresponding messages. If <parameter>cookie</parameter> is set | |
48 | to <constant>NULL</constant> and the message is not sealed, <function>sd_bus_send()</function> | |
49 | assumes the message <parameter>m</parameter> doesn't expect a reply and adds the necessary | |
50 | headers to indicate this.</para> | |
51 | ||
52 | <para>Note that in most scenarios, <function>sd_bus_send()</function> should not be called | |
53 | directly. Instead, use higher level functions such as | |
54 | <citerefentry><refentrytitle>sd_bus_call_method</refentrytitle><manvolnum>3</manvolnum></citerefentry> and | |
55 | <citerefentry><refentrytitle>sd_bus_reply_method_return</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
56 | which call <function>sd_bus_send()</function> internally.</para> | |
57 | </refsect1> | |
58 | ||
59 | <refsect1> | |
60 | <title>Return Value</title> | |
61 | ||
62 | <para>On success, this function returns a non-negative integer. On failure, it returns a | |
63 | negative errno-style error code.</para> | |
64 | ||
65 | <refsect2 id='errors'> | |
66 | <title>Errors</title> | |
67 | ||
68 | <para>Returned errors may indicate the following problems:</para> | |
69 | ||
70 | <variablelist> | |
71 | <varlistentry> | |
72 | <term><constant>-EINVAL</constant></term> | |
73 | ||
74 | <listitem><para>The input parameter <parameter>m</parameter> is <constant>NULL</constant>. | |
75 | </para></listitem> | |
76 | </varlistentry> | |
77 | ||
78 | <varlistentry> | |
79 | <term><constant>-EOPNOTSUPP</constant></term> | |
80 | ||
81 | <listitem><para>The bus connection does not support sending file descriptors. | |
82 | </para></listitem> | |
83 | </varlistentry> | |
84 | ||
85 | <varlistentry> | |
86 | <term><constant>-ECHILD</constant></term> | |
87 | ||
88 | <listitem><para>The bus connection was allocated in a parent process and is being reused | |
89 | in a child process after <function>fork()</function>.</para></listitem> | |
90 | </varlistentry> | |
91 | ||
92 | <varlistentry> | |
93 | <term><constant>-ENOBUFS</constant></term> | |
94 | ||
95 | <listitem><para>The bus connection's write queue is full.</para></listitem> | |
96 | </varlistentry> | |
97 | ||
98 | <varlistentry> | |
99 | <term><constant>-ENOTCONN</constant></term> | |
100 | ||
101 | <listitem><para>The input parameter <parameter>bus</parameter> is | |
102 | <constant>NULL</constant> or the bus is not connected.</para></listitem> | |
103 | </varlistentry> | |
104 | ||
105 | <varlistentry> | |
106 | <term><constant>-ECONNRESET</constant></term> | |
107 | ||
108 | <listitem><para>The bus connection was closed while waiting for the response. | |
109 | </para></listitem> | |
110 | </varlistentry> | |
111 | ||
112 | <varlistentry> | |
113 | <term><constant>-ENOMEM</constant></term> | |
114 | ||
115 | <listitem><para>Memory allocation failed.</para></listitem> | |
116 | </varlistentry> | |
117 | </variablelist> | |
118 | </refsect2> | |
119 | </refsect1> | |
120 | ||
121 | <xi:include href="libsystemd-pkgconfig.xml" /> | |
122 | ||
123 | <refsect1> | |
124 | <title>See Also</title> | |
125 | ||
126 | <para> | |
127 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
128 | <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
129 | <citerefentry><refentrytitle>sd_bus_call_method</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
130 | <citerefentry><refentrytitle>sd_bus_message_set_destination</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
131 | <citerefentry><refentrytitle>sd_bus_reply_method_return</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
132 | <citerefentry><refentrytitle>sd_bus_send_to</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
133 | </para> | |
134 | </refsect1> | |
135 | ||
136 | </refentry> |