LibCore: Implement FileWatcher for any systems with inotify

FreeBSD 15 added support for inotify so let's just allow this file to
be used there too as it's needed for watching the time zone file.
This commit is contained in:
Undefine 2025-12-30 00:04:13 +01:00 committed by Andrew Kaster
parent 7cfb03fa37
commit 941797c807
2 changed files with 11 additions and 9 deletions

View file

@ -80,28 +80,34 @@ else()
list(APPEND SOURCES LocalServerWindows.cpp)
endif()
# FIXME: Implement these for other systems.
include(CheckIncludeFile)
check_include_file(sys/inotify.h HAVE_INOTIFY)
if (HAVE_INOTIFY)
list(APPEND SOURCES FileWatcherInotify.cpp)
else()
list(APPEND SOURCES FileWatcherUnimplemented.cpp)
endif()
# FIXME: Implement ProcessStatistics for Windows and *BSD
if (LINUX)
list(APPEND SOURCES
FileWatcherLinux.cpp
Platform/ProcessStatisticsLinux.cpp
TimeZoneWatcherLinux.cpp
)
elseif (APPLE AND NOT IOS)
list(APPEND SOURCES
FileWatcherUnimplemented.cpp
Platform/ProcessStatisticsMach.cpp
TimeZoneWatcherMacOS.mm
)
elseif (WIN32)
list(APPEND SOURCES
FileWatcherUnimplemented.cpp
Platform/ProcessStatisticsUnimplemented.cpp
TimeZoneWatcherWindows.cpp
)
else()
list(APPEND SOURCES
FileWatcherUnimplemented.cpp
Platform/ProcessStatisticsUnimplemented.cpp
TimeZoneWatcherUnimplemented.cpp
)

View file

@ -16,10 +16,6 @@
#include <sys/ioctl.h>
#include <unistd.h>
#if !defined(AK_OS_LINUX)
static_assert(false, "This file must only be used for Linux");
#endif
namespace Core {
static constexpr unsigned file_watcher_flags_to_inotify_flags(FileWatcherFlags flags)