system/FileDescriptor: make inotify_init1() mandatory on Linux

This commit is contained in:
Max Kellermann 2018-08-20 17:12:50 +02:00
parent 8106929d60
commit 13b3e9e7b3
3 changed files with 4 additions and 14 deletions

View File

@ -587,9 +587,7 @@ if test x$enable_qobuz != xno || test x$enable_soundcloud != xno || test x$enabl
fi fi
dnl --------------------------------- inotify --------------------------------- dnl --------------------------------- inotify ---------------------------------
AC_CHECK_FUNCS(inotify_init inotify_init1) if test x$host_is_linux = xno; then
if test x$ac_cv_func_inotify_init = xno; then
enable_inotify=no enable_inotify=no
fi fi

View File

@ -45,7 +45,7 @@
#include <sys/signalfd.h> #include <sys/signalfd.h>
#endif #endif
#ifdef HAVE_INOTIFY_INIT #ifdef __linux__
#include <sys/inotify.h> #include <sys/inotify.h>
#endif #endif
@ -248,23 +248,15 @@ FileDescriptor::CreateSignalFD(const sigset_t *mask) noexcept
#endif #endif
#ifdef HAVE_INOTIFY_INIT #ifdef __linux__
bool bool
FileDescriptor::CreateInotify() noexcept FileDescriptor::CreateInotify() noexcept
{ {
#ifdef HAVE_INOTIFY_INIT1
int new_fd = inotify_init1(IN_CLOEXEC|IN_NONBLOCK); int new_fd = inotify_init1(IN_CLOEXEC|IN_NONBLOCK);
#else
int new_fd = inotify_init();
#endif
if (new_fd < 0) if (new_fd < 0)
return false; return false;
#ifndef HAVE_INOTIFY_INIT1
SetNonBlocking();
#endif
fd = new_fd; fd = new_fd;
return true; return true;
} }

View File

@ -189,7 +189,7 @@ public:
bool CreateSignalFD(const sigset_t *mask) noexcept; bool CreateSignalFD(const sigset_t *mask) noexcept;
#endif #endif
#ifdef HAVE_INOTIFY_INIT #ifdef __linux__
bool CreateInotify() noexcept; bool CreateInotify() noexcept;
#endif #endif