mirror of
https://github.com/systemd/systemd
synced 2024-10-15 20:45:09 +00:00
errno-util: add three more error codes to ERRNO_IS_DISCONNECT()
This is based on the recommendations in accept4() and the listed error codes there.
This commit is contained in:
parent
7ebd758cf6
commit
916a9ec7c6
|
@ -32,11 +32,23 @@ static inline int negative_errno(void) {
|
|||
*
|
||||
* Hint #2: The kernel sends e.g., EHOSTUNREACH or ENONET to userspace in some ICMP error cases. See the
|
||||
* icmp_err_convert[] in net/ipv4/icmp.c in the kernel sources */
|
||||
#define ERRNO_IS_DISCONNECT(r) \
|
||||
IN_SET(abs(r), \
|
||||
ENOTCONN, ECONNRESET, ECONNREFUSED, ECONNABORTED, EPIPE, \
|
||||
ENETUNREACH, EHOSTUNREACH, ENOPROTOOPT, EHOSTDOWN, \
|
||||
ENONET, ESHUTDOWN)
|
||||
static inline bool ERRNO_IS_DISCONNECT(int r) {
|
||||
return IN_SET(abs(r),
|
||||
ECONNABORTED,
|
||||
ECONNREFUSED,
|
||||
ECONNRESET,
|
||||
EHOSTDOWN,
|
||||
EHOSTUNREACH,
|
||||
ENETDOWN,
|
||||
ENETRESET,
|
||||
ENETUNREACH,
|
||||
ENONET,
|
||||
ENOPROTOOPT,
|
||||
ENOTCONN,
|
||||
EPIPE,
|
||||
EPROTO,
|
||||
ESHUTDOWN);
|
||||
}
|
||||
|
||||
/* Resource exhaustion, could be our fault or general system trouble */
|
||||
#define ERRNO_IS_RESOURCE(r) \
|
||||
|
|
Loading…
Reference in a new issue