238 lines
6.1 KiB
HTML
238 lines
6.1 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of SD_BUS_MESSAGE_NEW_METHOD_ERROR</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>SD_BUS_MESSAGE_NEW_METHOD_ERROR</H1>
|
|
Section: sd_bus_message_new_method_error (3)<BR>Updated: <BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
sd_bus_message_new_method_error, sd_bus_message_new_method_errorf, sd_bus_message_new_method_errno, sd_bus_message_new_method_errnof - Create a an error reply for a method call
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<P>
|
|
<B>
|
|
</B><PRE>
|
|
#include <<A HREF="file:///usr/include/systemd/sd-bus.h">systemd/sd-bus.h</A>>
|
|
</PRE>
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="1">
|
|
<B>int sd_bus_message_new_method_error(sd_bus_message *</B><I>call</I><B>, sd_bus_message **</B><I>m</I><B>, const sd_bus_error *</B><I>e</I><B>);</B>
|
|
|
|
<DT id="2">
|
|
<B>int sd_bus_message_new_method_errorf(sd_bus_message *</B><I>call</I><B>, sd_bus_message **</B><I>m</I><B>, const char *</B><I>name</I><B>, const char *</B><I>format</I><B>, ...);</B>
|
|
|
|
<DT id="3">
|
|
<B>int sd_bus_message_new_method_errno(sd_bus_message *</B><I>call</I><B>, sd_bus_message **</B><I>m</I><B>, int </B><I>error</I><B>, const sd_bus_error *</B><I>p</I><B>);</B>
|
|
|
|
<DT id="4">
|
|
<B>int sd_bus_message_new_method_errnof(sd_bus_message *</B><I>call</I><B>, sd_bus_message **</B><I>m</I><B>, int </B><I>error</I><B>, const char *</B><I>format</I><B>, ...);</B>
|
|
|
|
</DL>
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<P>
|
|
|
|
<DD>The
|
|
<B>sd_bus_message_new_method_error()</B>
|
|
function creates a new bus message object that is an error reply to the
|
|
<I>call</I>
|
|
message, and returns it in the
|
|
<I>m</I>
|
|
output parameter. The error information from error
|
|
<I>e</I>
|
|
is appended: the
|
|
<I>name</I>
|
|
field of
|
|
<I>e</I>
|
|
is used as the error identifier in the reply header (for example an error name such as
|
|
"org.freedesktop.DBus.Error.NotSupported"
|
|
or the equivalent symbolic
|
|
<B>SD_BUS_ERROR_NOT_SUPPORTED</B>), and the
|
|
<I>message</I>
|
|
field is set as the human readable error message string if present. The error
|
|
<I>e</I>
|
|
must have the
|
|
<I>name</I>
|
|
field set, see
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_error_is_set">sd_bus_error_is_set</A></B>(3).
|
|
<P>
|
|
|
|
The
|
|
<B>sd_bus_message_new_method_errorf()</B>
|
|
function creates an error reply similarly to
|
|
<B>sd_bus_message_new_method_error()</B>, but instead of a ready error structure, it takes an error identifier string
|
|
<I>name</I>, plus a
|
|
<B><A HREF="/cgi-bin/man/man2html?3+printf">printf</A></B>(3)
|
|
format string
|
|
<I>format</I>
|
|
and corresponding arguments. An error reply is sent with the error identifier
|
|
<I>name</I>
|
|
and the formatted string as the message.
|
|
<I>name</I>
|
|
and
|
|
<I>format</I>
|
|
must not be
|
|
<B>NULL</B>.
|
|
<P>
|
|
|
|
The
|
|
<B>sd_bus_message_new_method_errno()</B>
|
|
function creates an error reply similarly to
|
|
<B>sd_bus_message_new_method_error()</B>, but in addition to the error structure
|
|
<I>p</I>, it takes an
|
|
<B><A HREF="/cgi-bin/man/man2html?3+errno">errno</A></B>(3)
|
|
error value in parameter
|
|
<I>error</I>. If the error
|
|
<I>p</I>
|
|
is set (see
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_error_is_set">sd_bus_error_is_set</A></B>(3)), it is used in the reply. Otherwise,
|
|
<I>error</I>
|
|
is translated to an error identifier and used to create a new error structure using
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_error_set_errno">sd_bus_error_set_errno</A></B>(3)
|
|
and that is used in the reply. (If
|
|
<I>error</I>
|
|
is zero, no error is actually set, and an error reply with no information is created.)
|
|
<P>
|
|
|
|
The
|
|
<B>sd_bus_message_new_method_errnof()</B>
|
|
function creates an error reply similarly to
|
|
<B>sd_bus_message_new_method_error()</B>. It takes an
|
|
<B><A HREF="/cgi-bin/man/man2html?3+errno">errno</A></B>(3)
|
|
error value in parameter
|
|
<I>error</I>, plus a
|
|
<B><A HREF="/cgi-bin/man/man2html?3+printf">printf</A></B>(3)
|
|
format string
|
|
<I>format</I>
|
|
and corresponding arguments.
|
|
"%m"
|
|
may be used in the format string to refer to the error string corresponding to the specified errno code. The error message is initialized using the error identifier generated from
|
|
<B>error</B>
|
|
and the formatted string. (If
|
|
<I>error</I>
|
|
is zero, no error is actually set, and an error reply with no information is created.)
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
<P>
|
|
|
|
These functions return 0 if the error reply was successfully created, and a negative errno-style error code otherwise.
|
|
<A NAME="lbAF"> </A>
|
|
<H3>Errors</H3>
|
|
|
|
<P>
|
|
|
|
Returned errors may indicate the following problems:
|
|
<P>
|
|
|
|
<B>-EINVAL</B>
|
|
<DL COMPACT><DT id="5"><DD>
|
|
The call message
|
|
<I>call</I>
|
|
or the output parameter
|
|
<I>m</I>
|
|
are
|
|
<B>NULL</B>.
|
|
<P>
|
|
Message
|
|
<I>call</I>
|
|
is not a method call message.
|
|
<P>
|
|
The error
|
|
<I>error</I>
|
|
parameter to
|
|
<B>sd_bus_message_new_method_error</B>
|
|
is not set, see
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_error_is_set">sd_bus_error_is_set</A></B>(3).
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>-EPERM</B>
|
|
<DL COMPACT><DT id="6"><DD>
|
|
Message
|
|
<I>call</I>
|
|
has been sealed.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>-ENOTCONN</B>
|
|
<DL COMPACT><DT id="7"><DD>
|
|
The bus to which message
|
|
<I>call</I>
|
|
is attached is not connected.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>-ENOMEM</B>
|
|
<DL COMPACT><DT id="8"><DD>
|
|
Memory allocation failed.
|
|
</DL>
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
<P>
|
|
|
|
These APIs are implemented as a shared library, which can be compiled and linked to with the
|
|
<B>libsystemd</B> <B><A HREF="/cgi-bin/man/man2html?1+pkg-config">pkg-config</A></B>(1)
|
|
file.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<P>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+systemd">systemd</A></B>(1),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd-bus">sd-bus</A></B>(3)
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="9"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="10"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="11"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="12"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DL>
|
|
<DT id="13"><A HREF="#lbAF">Errors</A><DD>
|
|
</DL>
|
|
<DT id="14"><A HREF="#lbAG">NOTES</A><DD>
|
|
<DT id="15"><A HREF="#lbAH">SEE ALSO</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:54 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|