From 13b3e9e7b30cd0a84967016515c0040288e3566f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 20 Aug 2018 17:12:50 +0200 Subject: [PATCH] system/FileDescriptor: make inotify_init1() mandatory on Linux --- configure.ac | 4 +--- src/system/FileDescriptor.cxx | 12 ++---------- src/system/FileDescriptor.hxx | 2 +- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index f671db19a..057c8bda9 100644 --- a/configure.ac +++ b/configure.ac @@ -587,9 +587,7 @@ if test x$enable_qobuz != xno || test x$enable_soundcloud != xno || test x$enabl fi dnl --------------------------------- inotify --------------------------------- -AC_CHECK_FUNCS(inotify_init inotify_init1) - -if test x$ac_cv_func_inotify_init = xno; then +if test x$host_is_linux = xno; then enable_inotify=no fi diff --git a/src/system/FileDescriptor.cxx b/src/system/FileDescriptor.cxx index db0814469..56b3c0104 100644 --- a/src/system/FileDescriptor.cxx +++ b/src/system/FileDescriptor.cxx @@ -45,7 +45,7 @@ #include #endif -#ifdef HAVE_INOTIFY_INIT +#ifdef __linux__ #include #endif @@ -248,23 +248,15 @@ FileDescriptor::CreateSignalFD(const sigset_t *mask) noexcept #endif -#ifdef HAVE_INOTIFY_INIT +#ifdef __linux__ bool FileDescriptor::CreateInotify() noexcept { -#ifdef HAVE_INOTIFY_INIT1 int new_fd = inotify_init1(IN_CLOEXEC|IN_NONBLOCK); -#else - int new_fd = inotify_init(); -#endif if (new_fd < 0) return false; -#ifndef HAVE_INOTIFY_INIT1 - SetNonBlocking(); -#endif - fd = new_fd; return true; } diff --git a/src/system/FileDescriptor.hxx b/src/system/FileDescriptor.hxx index 849cde5ec..9c608f6d9 100644 --- a/src/system/FileDescriptor.hxx +++ b/src/system/FileDescriptor.hxx @@ -189,7 +189,7 @@ public: bool CreateSignalFD(const sigset_t *mask) noexcept; #endif -#ifdef HAVE_INOTIFY_INIT +#ifdef __linux__ bool CreateInotify() noexcept; #endif