1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
[[!meta copyright="Copyright © 2025 Free Software Foundation, Inc."]]
[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable
id="license" text="Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no Invariant
Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license
is included in the section entitled [[GNU Free Documentation
License|/fdl]]."]]"""]]
[[!meta title="glibc error reporting"]]
When reporting errors in the Hurd part of glibc, please use these
functions. They can be found in `$glibc-SRC/hurd/hurd/fd.h`.
`__hurd_fail (error_t err)`
The `__hurd_fail ()` inline function is the recommended way of
reporting errors in the Hurd part of glibc. It is more concise than `{
errno = err; return -1; }`, and it translates some MIG and Mach errors
into POSIX errors.
You can see some example uses of it from this
[[email|https://lists.gnu.org/archive/html/bug-hurd/2023-05/msg00369.html]]
to bug-hurd.
extern int __hurd_dfail (int fd, error_t err);
Handle error code `ERR` from an RPC on file descriptor FD's port.
This function converts some errors into signals as expressed by
POSIX. It sets `errno` to the appropriate error code and always return
-1. Most developers will rarely use this function, since `__hurd_fail
()` handles most usecases.
`_hurd_fd_error (error_t err)`
Handle an error from an RPC on a file descriptor's port. This
function is almost the same as `__hurd_dfail ()`. `_hurd_fd_error ()`
returns the error, while `__hurd_dfail ()` sets errno and returns
`-1`. You should always use this function to handle errors from RPCs
made on file descriptor ports. Some errors are translated into
signals.
`__hurd_sockfail (int fd, int flags, error_t err)`
Handle error code ERR from an RPC on file descriptor FD's port. Set
`errno` to the appropriate error code, and always return -1. It
differs from `__hurd_dfail ()` in that it does not raise `SIGPIPE` on
`EPIPE` if flags contain `MSG_NOSIGNAL`.
extern int _hurd_fd_error_signal (error_t err);
Check if ERR should generate a signal. Returns the signal to take, or
zero if none.
|