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
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

View File

@ -45,7 +45,7 @@
#include <sys/signalfd.h>
#endif
#ifdef HAVE_INOTIFY_INIT
#ifdef __linux__
#include <sys/inotify.h>
#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;
}

View File

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