-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <stdio.h>
#include <dirent.h>
#include <stdbool.h>
+#include <stdio.h>
#include <sys/socket.h>
#include "macro.h"
int fclose_nointr(FILE *f);
FILE* safe_fclose(FILE *f);
-// UNNEEDED DIR* safe_closedir(DIR *f);
+#if 0 /// UNNEEDED by elogind
+DIR* safe_closedir(DIR *f);
+#endif // 0
static inline void closep(int *fd) {
safe_close(*fd);
int close_all_fds(const int except[], unsigned n_except);
-// UNNEEDED int same_fd(int a, int b);
+#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);
-// UNNEEDED void cmsg_close_all(struct msghdr *mh);
+int fd_get_path(int fd, char **ret);
+#endif // 0
-// UNNEEDED bool fdname_is_valid(const char *s);
+/* 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)