X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fbasic%2Ffd-util.h;h=fe92b76c405c5880987e31dea53ff16076f61649;hp=16304a1afa70f45d90d78814e8adcc3ce27ab9bc;hb=9742b1e43855b1599bd52ff95af995d9a9d35eac;hpb=c5729796b4ec5e5f4800bfe6bd9ceb5c2da81fbe diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h index 16304a1af..fe92b76c4 100644 --- a/src/basic/fd-util.h +++ b/src/basic/fd-util.h @@ -1,5 +1,3 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - #pragma once /*** @@ -21,9 +19,9 @@ along with systemd; If not, see . ***/ -#include #include #include +#include #include #include "macro.h" @@ -67,6 +65,7 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(DIR*, closedir); int fd_nonblock(int fd, bool nonblock); int fd_cloexec(int fd, bool cloexec); +void stdio_unset_cloexec(void); int close_all_fds(const int except[], unsigned n_except); @@ -76,4 +75,10 @@ int same_fd(int a, int b); void cmsg_close_all(struct msghdr *mh); bool fdname_is_valid(const char *s); + +int fd_get_path(int fd, char **ret); #endif // 0 + +/* Hint: ENETUNREACH happens if we try to connect to "non-existing" special IP addresses, such as ::5 */ +#define ERRNO_IS_DISCONNECT(r) \ + IN_SET(r, ENOTCONN, ECONNRESET, ECONNREFUSED, ECONNABORTED, EPIPE, ENETUNREACH)