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+ -->
6 <refentry id=
"sd_bus_reply_method_error"
7 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
10 <title>sd_bus_reply_method_error
</title>
11 <productname>systemd
</productname>
15 <refentrytitle>sd_bus_reply_method_error
</refentrytitle>
16 <manvolnum>3</manvolnum>
20 <refname>sd_bus_reply_method_error
</refname>
21 <refname>sd_bus_reply_method_errorf
</refname>
22 <refname>sd_bus_reply_method_errno
</refname>
23 <refname>sd_bus_reply_method_errnof
</refname>
25 <refpurpose>Reply with an error to a method call
</refpurpose>
30 <funcsynopsisinfo>#include
<systemd/sd-bus.h
></funcsynopsisinfo>
33 <funcdef>int sd_bus_reply_method_error
</funcdef>
34 <paramdef>sd_bus_message *
<parameter>call
</parameter></paramdef>
35 <paramdef>const sd_bus_error *
<parameter>e
</parameter></paramdef>
39 <funcdef>int sd_bus_reply_method_errorf
</funcdef>
40 <paramdef>sd_bus_message *
<parameter>call
</parameter></paramdef>
41 <paramdef>const char *
<parameter>name
</parameter></paramdef>
42 <paramdef>const char *
<parameter>format
</parameter></paramdef>
43 <paramdef>…
</paramdef>
47 <funcdef>int sd_bus_reply_method_errno
</funcdef>
48 <paramdef>sd_bus_message *
<parameter>call
</parameter></paramdef>
49 <paramdef>int
<parameter>error
</parameter></paramdef>
50 <paramdef>const sd_bus_error *
<parameter>p
</parameter></paramdef>
54 <funcdef>int sd_bus_reply_method_errnof
</funcdef>
55 <paramdef>sd_bus_message *
<parameter>call
</parameter></paramdef>
56 <paramdef>int
<parameter>error
</parameter></paramdef>
57 <paramdef>const char *
<parameter>format
</parameter></paramdef>
58 <paramdef>…
</paramdef>
64 <title>Description
</title>
66 <para>The
<function>sd_bus_reply_method_error()
</function> function sends an
67 error reply to the
<parameter>call
</parameter> message. The error structure
68 <parameter>e
</parameter> specifies the error to send, and is used as described in
69 <citerefentry><refentrytitle>sd_bus_message_new_error
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
70 If no reply is expected to
<parameter>call
</parameter>, this function returns
71 success without sending reply.
</para>
73 <para>The
<function>sd_bus_reply_method_errorf()
</function> is to
74 <function>sd_bus_reply_method_error()
</function> what
75 <function>sd_bus_message_new_method_errorf()
</function> is to
76 <function>sd_bus_message_new_method_error()
</function>.
</para>
78 <para>The
<function>sd_bus_reply_method_errno()
</function> is to
79 <function>sd_bus_reply_method_error()
</function> what
80 <function>sd_bus_message_new_method_errno()
</function> is to
81 <function>sd_bus_message_new_method_error()
</function>.
</para>
83 <para>The
<function>sd_bus_reply_method_errnof()
</function> is to
84 <function>sd_bus_reply_method_error()
</function> what
85 <function>sd_bus_message_new_method_errnof()
</function> is to
86 <function>sd_bus_message_new_method_error()
</function>.
</para>
90 <title>Return Value
</title>
92 <para>These functions return
0 if the error reply was successfully sent or if
93 none was expected, and a negative errno-style error code otherwise.
</para>
98 <para>Returned errors may indicate the following problems:
</para>
102 <term><constant>-EINVAL
</constant></term>
104 <listitem><para>The call message
<parameter>call
</parameter> is
105 <constant>NULL
</constant>.
</para>
107 <para>Message
<parameter>call
</parameter> is not a method call message.
110 <para>Message
<parameter>call
</parameter> is not attached to a bus.
</para>
112 <para>The error
<parameter>error
</parameter> parameter to
113 <function>sd_bus_reply_method_error
</function> is not set, see
114 <citerefentry><refentrytitle>sd_bus_error_is_set
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
120 <term><constant>-EPERM
</constant></term>
122 <listitem><para>Message
<parameter>call
</parameter> has been sealed.
127 <term><constant>-ENOTCONN
</constant></term>
129 <listitem><para>The bus to which message
<parameter>call
</parameter> is attached is not
130 connected.
</para></listitem>
134 <term><constant>-ENOMEM
</constant></term>
136 <listitem><para>Memory allocation failed.
</para></listitem>
140 <para>In addition, any error message returned by
141 <citerefentry><refentrytitle>sd_bus_send
</refentrytitle><manvolnum>1</manvolnum></citerefentry>
142 may be returned.
</para>
146 <xi:include href=
"libsystemd-pkgconfig.xml" />
149 <title>See Also
</title>
152 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
153 <citerefentry><refentrytitle>sd-bus
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
154 <citerefentry><refentrytitle>sd_bus_message_new_method_error
</refentrytitle><manvolnum>3</manvolnum></citerefentry>