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=522ea6894955c10233e04d304566d65849e8fe1c;hp=0e03e26b09c32a42c2a091687704a369ee43a1b4;hb=7b4a8335022121d06336eae363f3d7fcbcac1c45;hpb=2705eaf36d46539397571886ba6ccd0045ef3e9b diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h index 0e03e26b0..522ea6894 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" @@ -40,8 +38,7 @@ void close_many(const int fds[], unsigned n_fd); int fclose_nointr(FILE *f); FILE* safe_fclose(FILE *f); -/// UNNEEDED by elogind -#if 0 +#if 0 /// UNNEEDED by elogind DIR* safe_closedir(DIR *f); #endif // 0 @@ -71,11 +68,16 @@ int fd_cloexec(int fd, bool cloexec); int close_all_fds(const int except[], unsigned n_except); -/// UNNEEDED by elogind -#if 0 +#if 0 /// UNNEEDED by elogind 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)