From 036e922c79820966342e6ebee143cde7d4724c6e Mon Sep 17 00:00:00 2001 From: stasoid Date: Sat, 16 Nov 2024 11:55:19 +0500 Subject: [PATCH] LibCore: Port MappedFile to Windows --- Libraries/LibCore/CMakeLists.txt | 4 ++++ Libraries/LibCore/MappedFile.cpp | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Libraries/LibCore/CMakeLists.txt b/Libraries/LibCore/CMakeLists.txt index 5ed2c0bc62a..d3136184d5b 100644 --- a/Libraries/LibCore/CMakeLists.txt +++ b/Libraries/LibCore/CMakeLists.txt @@ -114,3 +114,7 @@ endif() if (ANDROID) target_link_libraries(LibCore PRIVATE log) endif() + +if (WIN32) + target_include_directories(LibCore PRIVATE ${MMAN_INCLUDE_DIR}) +endif() diff --git a/Libraries/LibCore/MappedFile.cpp b/Libraries/LibCore/MappedFile.cpp index 3660c2c9e32..c8d45a88f6a 100644 --- a/Libraries/LibCore/MappedFile.cpp +++ b/Libraries/LibCore/MappedFile.cpp @@ -9,9 +9,7 @@ #include #include #include -#include #include -#include namespace Core { @@ -30,7 +28,7 @@ ErrorOr> MappedFile::map_from_file(NonnullOwnPtr> MappedFile::map_from_fd_and_close(int fd, [[maybe_unused]] StringView path, Mode mode) { ScopeGuard fd_close_guard = [fd] { - ::close(fd); + (void)System::close(fd); }; auto stat = TRY(Core::System::fstat(fd));