util: move ERRNO_IS_xyz macros to errno-util.h
It's where they fit much better.
This commit is contained in:
parent
594da0a3e1
commit
c3fecddf0d
|
@ -27,3 +27,16 @@ static inline int negative_errno(void) {
|
||||||
assert_return(errno > 0, -EINVAL);
|
assert_return(errno > 0, -EINVAL);
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Hint #1: ENETUNREACH happens if we try to connect to "non-existing" special IP addresses, such as ::5.
|
||||||
|
*
|
||||||
|
* 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)
|
||||||
|
|
||||||
|
/* Resource exhaustion, could be our fault or general system trouble */
|
||||||
|
#define ERRNO_IS_RESOURCE(r) \
|
||||||
|
IN_SET(abs(r), ENOMEM, EMFILE, ENFILE)
|
||||||
|
|
|
@ -77,18 +77,6 @@ int acquire_data_fd(const void *data, size_t size, unsigned flags);
|
||||||
|
|
||||||
int fd_duplicate_data_fd(int fd);
|
int fd_duplicate_data_fd(int fd);
|
||||||
|
|
||||||
/* Hint: ENETUNREACH happens if we try to connect to "non-existing" special IP addresses, such as ::5 */
|
|
||||||
/* 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)
|
|
||||||
|
|
||||||
/* Resource exhaustion, could be our fault or general system trouble */
|
|
||||||
#define ERRNO_IS_RESOURCE(r) \
|
|
||||||
IN_SET(abs(r), ENOMEM, EMFILE, ENFILE)
|
|
||||||
|
|
||||||
int fd_move_above_stdio(int fd);
|
int fd_move_above_stdio(int fd);
|
||||||
|
|
||||||
int rearrange_stdio(int original_input_fd, int original_output_fd, int original_error_fd);
|
int rearrange_stdio(int original_input_fd, int original_output_fd, int original_error_fd);
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "dns-domain.h"
|
#include "dns-domain.h"
|
||||||
#include "errno-list.h"
|
#include "errno-list.h"
|
||||||
|
#include "errno-util.h"
|
||||||
#include "fd-util.h"
|
#include "fd-util.h"
|
||||||
#include "random-util.h"
|
#include "random-util.h"
|
||||||
#include "resolved-dns-cache.h"
|
#include "resolved-dns-cache.h"
|
||||||
|
|
Loading…
Reference in New Issue