fd-util: beef up ERRNO_IS_xyz() macros a bit

Let's implicit drop the negation if there is one, to simplify things a
bit, similar how we do it in log_xyz()...
This commit is contained in:
Lennart Poettering
2019-03-19 12:56:25 +01:00
parent 17b70256f2
commit 594da0a3e1

View File

@@ -81,13 +81,13 @@ int fd_duplicate_data_fd(int fd);
/* 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(r, \
IN_SET(abs(r), \
ENOTCONN, ECONNRESET, ECONNREFUSED, ECONNABORTED, EPIPE, \
ENETUNREACH, EHOSTUNREACH, ENOPROTOOPT, EHOSTDOWN, ENONET)
/* Resource exhaustion, could be our fault or general system trouble */
#define ERRNO_IS_RESOURCE(r) \
IN_SET(r, ENOMEM, EMFILE, ENFILE)
IN_SET(abs(r), ENOMEM, EMFILE, ENFILE)
int fd_move_above_stdio(int fd);