| 1 |
'\" t |
| 2 |
.TH "SD_BUS_REPLY_METHOD_ERROR" "3" "" "systemd 261~rc3" "sd_bus_reply_method_error" |
| 3 |
.\" ----------------------------------------------------------------- |
| 4 |
.\" * Define some portability stuff |
| 5 |
.\" ----------------------------------------------------------------- |
| 6 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 7 |
.\" http://bugs.debian.org/507673 |
| 8 |
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html |
| 9 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 10 |
.ie \n(.g .ds Aq \(aq |
| 11 |
.el .ds Aq ' |
| 12 |
.\" ----------------------------------------------------------------- |
| 13 |
.\" * set default formatting |
| 14 |
.\" ----------------------------------------------------------------- |
| 15 |
.\" disable hyphenation |
| 16 |
.nh |
| 17 |
.\" disable justification (adjust text to left margin only) |
| 18 |
.ad l |
| 19 |
.\" ----------------------------------------------------------------- |
| 20 |
.\" * MAIN CONTENT STARTS HERE * |
| 21 |
.\" ----------------------------------------------------------------- |
| 22 |
.SH "NAME" |
| 23 |
sd_bus_reply_method_error, sd_bus_reply_method_errorf, sd_bus_reply_method_errorfv, sd_bus_reply_method_errno, sd_bus_reply_method_errnof, sd_bus_reply_method_errnofv \- Reply with an error to a D\-Bus method call |
| 24 |
.SH "SYNOPSIS" |
| 25 |
.sp |
| 26 |
.ft B |
| 27 |
.nf |
| 28 |
#include <systemd/sd\-bus\&.h> |
| 29 |
.fi |
| 30 |
.ft |
| 31 |
.HP \w'int\ sd_bus_reply_method_error('u |
| 32 |
.BI "int sd_bus_reply_method_error(sd_bus_message\ *" "call" ", const\ sd_bus_error\ *" "e" ");" |
| 33 |
.HP \w'int\ sd_bus_reply_method_errorf('u |
| 34 |
.BI "int sd_bus_reply_method_errorf(sd_bus_message\ *" "call" ", const\ char\ *" "name" ", const\ char\ *" "format" ", \&.\&.\&.);" |
| 35 |
.HP \w'int\ sd_bus_reply_method_errorfv('u |
| 36 |
.BI "int sd_bus_reply_method_errorfv(sd_bus_message\ *" "call" ", const\ char\ *" "name" ", const\ char\ *" "format" ", va_list\ " "ap" ");" |
| 37 |
.HP \w'int\ sd_bus_reply_method_errno('u |
| 38 |
.BI "int sd_bus_reply_method_errno(sd_bus_message\ *" "call" ", int\ " "error" ", const\ sd_bus_error\ *" "p" ");" |
| 39 |
.HP \w'int\ sd_bus_reply_method_errnof('u |
| 40 |
.BI "int sd_bus_reply_method_errnof(sd_bus_message\ *" "call" ", int\ " "error" ", const\ char\ *" "format" ", \&.\&.\&.);" |
| 41 |
.HP \w'int\ sd_bus_reply_method_errnofv('u |
| 42 |
.BI "int sd_bus_reply_method_errnofv(sd_bus_message\ *" "call" ", int\ " "error" ", const\ char\ *" "format" ", va_list\ " "ap" ");" |
| 43 |
.SH "DESCRIPTION" |
| 44 |
.PP |
| 45 |
The |
| 46 |
\fBsd_bus_reply_method_error()\fR |
| 47 |
function sends an error reply to the |
| 48 |
\fIcall\fR |
| 49 |
message\&. The error structure |
| 50 |
\fIe\fR |
| 51 |
specifies the error to send, and is used as described in |
| 52 |
\fBsd_bus_message_new_method_error\fR(3)\&. If no reply is expected to |
| 53 |
\fIcall\fR, this function succeeds without sending a reply\&. |
| 54 |
.PP |
| 55 |
The |
| 56 |
\fBsd_bus_reply_method_errorf()\fR |
| 57 |
is to |
| 58 |
\fBsd_bus_reply_method_error()\fR |
| 59 |
what |
| 60 |
\fBsd_bus_message_new_method_errorf()\fR |
| 61 |
is to |
| 62 |
\fBsd_bus_message_new_method_error()\fR\&. |
| 63 |
.PP |
| 64 |
The |
| 65 |
\fBsd_bus_reply_method_errno()\fR |
| 66 |
is to |
| 67 |
\fBsd_bus_reply_method_error()\fR |
| 68 |
what |
| 69 |
\fBsd_bus_message_new_method_errno()\fR |
| 70 |
is to |
| 71 |
\fBsd_bus_message_new_method_error()\fR\&. |
| 72 |
.PP |
| 73 |
The |
| 74 |
\fBsd_bus_reply_method_errnof()\fR |
| 75 |
is to |
| 76 |
\fBsd_bus_reply_method_error()\fR |
| 77 |
what |
| 78 |
\fBsd_bus_message_new_method_errnof()\fR |
| 79 |
is to |
| 80 |
\fBsd_bus_message_new_method_error()\fR\&. |
| 81 |
.SH "RETURN VALUE" |
| 82 |
.PP |
| 83 |
This function returns a non\-negative integer if the error reply was successfully sent or if |
| 84 |
\fIcall\fR |
| 85 |
does not expect a reply\&. On failure, it returns a negative errno\-style error code\&. |
| 86 |
.SS "Errors" |
| 87 |
.PP |
| 88 |
Returned errors may indicate the following problems: |
| 89 |
.PP |
| 90 |
\fB\-EINVAL\fR |
| 91 |
.RS 4 |
| 92 |
The input parameter |
| 93 |
\fIcall\fR |
| 94 |
is |
| 95 |
\fBNULL\fR\&. |
| 96 |
.sp |
| 97 |
Message |
| 98 |
\fIcall\fR |
| 99 |
is not a method call message\&. |
| 100 |
.sp |
| 101 |
Message |
| 102 |
\fIcall\fR |
| 103 |
is not attached to a bus\&. |
| 104 |
.sp |
| 105 |
The error parameter |
| 106 |
\fIe\fR |
| 107 |
to |
| 108 |
\fBsd_bus_reply_method_error()\fR |
| 109 |
is not set, see |
| 110 |
\fBsd_bus_error_is_set\fR(3)\&. |
| 111 |
.RE |
| 112 |
.PP |
| 113 |
\fB\-EPERM\fR |
| 114 |
.RS 4 |
| 115 |
Message |
| 116 |
\fIcall\fR |
| 117 |
has been sealed\&. |
| 118 |
.RE |
| 119 |
.PP |
| 120 |
\fB\-ENOTCONN\fR |
| 121 |
.RS 4 |
| 122 |
The bus to which message |
| 123 |
\fIcall\fR |
| 124 |
is attached is not connected\&. |
| 125 |
.RE |
| 126 |
.PP |
| 127 |
\fB\-ENOMEM\fR |
| 128 |
.RS 4 |
| 129 |
Memory allocation failed\&. |
| 130 |
.RE |
| 131 |
.PP |
| 132 |
In addition, any error returned by |
| 133 |
\fBsd_bus_send\fR(3) |
| 134 |
may be returned\&. |
| 135 |
.SH "NOTES" |
| 136 |
.PP |
| 137 |
Functions described here are available as a shared library, which can be compiled against and linked to with the |
| 138 |
\fBlibsystemd\fR\ \&\fBpkg-config\fR(1) |
| 139 |
file\&. |
| 140 |
.PP |
| 141 |
The code described here uses |
| 142 |
\fBgetenv\fR(3), which is declared to be not multi\-thread\-safe\&. This means that the code calling the functions described here must not call |
| 143 |
\fBsetenv\fR(3) |
| 144 |
from a parallel thread\&. It is recommended to only do calls to |
| 145 |
\fBsetenv()\fR |
| 146 |
from an early phase of the program when no other threads have been started\&. |
| 147 |
.SH "SEE ALSO" |
| 148 |
.PP |
| 149 |
\fBsystemd\fR(1), \fBsd-bus\fR(3), \fBsd_bus_message_new_method_error\fR(3) |