]>
Commit | Line | Data |
---|---|---|
62994100 ZJS |
1 | <?xml version='1.0'?> |
2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | |
3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> | |
4 | ||
5 | <!-- | |
6 | SPDX-License-Identifier: LGPL-2.1+ | |
7 | --> | |
8 | ||
9 | <refentry id="sd_bus_reply_method_error" | |
10 | xmlns:xi="http://www.w3.org/2001/XInclude"> | |
11 | ||
12 | <refentryinfo> | |
13 | <title>sd_bus_reply_method_error</title> | |
14 | <productname>systemd</productname> | |
15 | </refentryinfo> | |
16 | ||
17 | <refmeta> | |
18 | <refentrytitle>sd_bus_reply_method_error</refentrytitle> | |
19 | <manvolnum>3</manvolnum> | |
20 | </refmeta> | |
21 | ||
22 | <refnamediv> | |
23 | <refname>sd_bus_reply_method_error</refname> | |
24 | <refname>sd_bus_reply_method_errorf</refname> | |
25 | <refname>sd_bus_reply_method_errno</refname> | |
26 | <refname>sd_bus_reply_method_errnof</refname> | |
27 | ||
28 | <refpurpose>Reply with an error to a method call</refpurpose> | |
29 | </refnamediv> | |
30 | ||
31 | <refsynopsisdiv> | |
32 | <funcsynopsis> | |
33 | <funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo> | |
34 | ||
35 | <funcprototype> | |
36 | <funcdef>int sd_bus_reply_method_error</funcdef> | |
37 | <paramdef>sd_bus_message *<parameter>call</parameter></paramdef> | |
38 | <paramdef>const sd_bus_error *<parameter>e</parameter></paramdef> | |
39 | </funcprototype> | |
40 | ||
41 | <funcprototype> | |
42 | <funcdef>int sd_bus_reply_method_errorf</funcdef> | |
43 | <paramdef>sd_bus_message *<parameter>call</parameter></paramdef> | |
44 | <paramdef>const char *<parameter>name</parameter></paramdef> | |
45 | <paramdef>const char *<parameter>format</parameter></paramdef> | |
46 | <paramdef>…</paramdef> | |
47 | </funcprototype> | |
48 | ||
49 | <funcprototype> | |
50 | <funcdef>int sd_bus_reply_method_errno</funcdef> | |
51 | <paramdef>sd_bus_message *<parameter>call</parameter></paramdef> | |
52 | <paramdef>int <parameter>error</parameter></paramdef> | |
53 | <paramdef>const sd_bus_error *<parameter>p</parameter></paramdef> | |
54 | </funcprototype> | |
55 | ||
56 | <funcprototype> | |
57 | <funcdef>int sd_bus_reply_method_errnof</funcdef> | |
58 | <paramdef>sd_bus_message *<parameter>call</parameter></paramdef> | |
59 | <paramdef>int <parameter>error</parameter></paramdef> | |
60 | <paramdef>const char *<parameter>format</parameter></paramdef> | |
61 | <paramdef>…</paramdef> | |
62 | </funcprototype> | |
63 | </funcsynopsis> | |
64 | </refsynopsisdiv> | |
65 | ||
66 | <refsect1> | |
67 | <title>Description</title> | |
68 | ||
69 | <para>The <function>sd_bus_reply_method_error()</function> function sends an | |
70 | error reply to the <parameter>call</parameter> message. The error structure | |
71 | <parameter>e</parameter> specifies the error to send, and is used as described in | |
72 | <citerefentry><refentrytitle>sd_bus_message_new_error</refentrytitle><manvolnum>3</manvolnum></citerefentry>. | |
73 | If no reply is expected to <parameter>call</parameter>, this function returns | |
74 | success without sending reply.</para> | |
75 | ||
76 | <para>The <function>sd_bus_reply_method_errorf()</function> is to | |
77 | <function>sd_bus_reply_method_error()</function> what | |
78 | <function>sd_bus_message_new_method_errorf()</function> is to | |
79 | <function>sd_bus_message_new_method_error()</function>.</para> | |
80 | ||
81 | <para>The <function>sd_bus_reply_method_errno()</function> is to | |
82 | <function>sd_bus_reply_method_error()</function> what | |
83 | <function>sd_bus_message_new_method_errno()</function> is to | |
84 | <function>sd_bus_message_new_method_error()</function>.</para> | |
85 | ||
86 | <para>The <function>sd_bus_reply_method_errnof()</function> is to | |
87 | <function>sd_bus_reply_method_error()</function> what | |
88 | <function>sd_bus_message_new_method_errnof()</function> is to | |
89 | <function>sd_bus_message_new_method_error()</function>.</para> | |
90 | </refsect1> | |
91 | ||
92 | <refsect1> | |
93 | <title>Return Value</title> | |
94 | ||
95 | <para>These functions return 0 if the error reply was successfully sent or if | |
96 | none was expected, and a negative errno-style error code otherwise.</para> | |
97 | </refsect1> | |
98 | ||
99 | <refsect1 id='errors'> | |
100 | <title>Errors</title> | |
101 | ||
102 | <para>Returned errors may indicate the following problems:</para> | |
103 | ||
104 | <variablelist> | |
105 | <varlistentry> | |
106 | <term><constant>-EINVAL</constant></term> | |
107 | ||
108 | <listitem><para>The call message <parameter>call</parameter> is | |
109 | <constant>NULL</constant>.</para> | |
110 | ||
111 | <para>Message <parameter>call</parameter> is not a method call message. | |
112 | </para> | |
113 | ||
114 | <para>Message <parameter>call</parameter> is not attached to a bus.</para> | |
115 | ||
116 | <para>The error <parameter>error</parameter> parameter to | |
117 | <function>sd_bus_reply_method_error</function> is not set, see | |
118 | <citerefentry><refentrytitle>sd_bus_error_is_set</refentrytitle><manvolnum>3</manvolnum></citerefentry>. | |
119 | </para> | |
120 | </listitem> | |
121 | </varlistentry> | |
122 | ||
123 | <varlistentry> | |
124 | <term><constant>-EPERM</constant></term> | |
125 | ||
126 | <listitem><para>Message <parameter>call</parameter> has been sealed. | |
127 | </para></listitem> | |
128 | </varlistentry> | |
129 | ||
130 | <varlistentry> | |
131 | <term><constant>-ENOTCONN</constant></term> | |
132 | ||
133 | <listitem><para>The bus to which message <parameter>call</parameter> is | |
134 | attached is not connected.</para></listitem> | |
135 | </varlistentry> | |
136 | ||
137 | <varlistentry> | |
138 | <term><constant>-ENOMEM</constant></term> | |
139 | ||
140 | <listitem><para>Memory allocation failed.</para></listitem> | |
141 | </varlistentry> | |
142 | </variablelist> | |
143 | ||
144 | <para>In addition, any error message returned by | |
145 | <citerefentry><refentrytitle>sd_bus_send</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
146 | may be returned.</para> | |
147 | </refsect1> | |
148 | ||
149 | <xi:include href="libsystemd-pkgconfig.xml" /> | |
150 | ||
151 | <refsect1> | |
152 | <title>See Also</title> | |
153 | ||
154 | <para> | |
155 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
156 | <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
157 | <citerefentry><refentrytitle>sd_bus_message_new_method_error</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
158 | </para> | |
159 | </refsect1> | |
160 | ||
161 | </refentry> |