]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
util: move ERRNO_IS_xyz macros to errno-util.h
authorLennart Poettering <lennart@poettering.net>
Tue, 19 Mar 2019 12:00:29 +0000 (13:00 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 19 Mar 2019 14:29:44 +0000 (15:29 +0100)
It's where they fit much better.

src/basic/errno-util.h
src/basic/fd-util.h
src/resolve/resolved-dns-transaction.c

index 2d72b8ce9ea22f0067dfeb93648460ef922e1f98..067b4fa3031f1fb93679dc399091fcf674809445 100644 (file)
@@ -27,3 +27,16 @@ static inline int negative_errno(void) {
         assert_return(errno > 0, -EINVAL);
         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)
index 8c3daf62a8278e83773c2b6f4b301f7875bcb4b4..e490753caf23a5c9559cd9bd72bd5023bad6745b 100644 (file)
@@ -77,18 +77,6 @@ int acquire_data_fd(const void *data, size_t size, unsigned flags);
 
 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 rearrange_stdio(int original_input_fd, int original_output_fd, int original_error_fd);
index 425627d97f11c9e577151ab5db632870683c27c2..9cac91f53603fc178741972f927aeebcc95fbbd5 100644 (file)
@@ -6,6 +6,7 @@
 #include "alloc-util.h"
 #include "dns-domain.h"
 #include "errno-list.h"
+#include "errno-util.h"
 #include "fd-util.h"
 #include "random-util.h"
 #include "resolved-dns-cache.h"