소스 검색

LibCore: Port MappedFile to Windows

stasoid 8 달 전
부모
커밋
b3464d0645
2개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 0
      Libraries/LibCore/CMakeLists.txt
  2. 1 3
      Libraries/LibCore/MappedFile.cpp

+ 4 - 0
Libraries/LibCore/CMakeLists.txt

@@ -114,3 +114,7 @@ endif()
 if (ANDROID)
 if (ANDROID)
     target_link_libraries(LibCore PRIVATE log)
     target_link_libraries(LibCore PRIVATE log)
 endif()
 endif()
+
+if (WIN32)
+    target_include_directories(LibCore PRIVATE ${MMAN_INCLUDE_DIR})
+endif()

+ 1 - 3
Libraries/LibCore/MappedFile.cpp

@@ -9,9 +9,7 @@
 #include <LibCore/File.h>
 #include <LibCore/File.h>
 #include <LibCore/MappedFile.h>
 #include <LibCore/MappedFile.h>
 #include <LibCore/System.h>
 #include <LibCore/System.h>
-#include <fcntl.h>
 #include <sys/mman.h>
 #include <sys/mman.h>
-#include <unistd.h>
 
 
 namespace Core {
 namespace Core {
 
 
@@ -30,7 +28,7 @@ ErrorOr<NonnullOwnPtr<MappedFile>> MappedFile::map_from_file(NonnullOwnPtr<Core:
 ErrorOr<NonnullOwnPtr<MappedFile>> MappedFile::map_from_fd_and_close(int fd, [[maybe_unused]] StringView path, Mode mode)
 ErrorOr<NonnullOwnPtr<MappedFile>> MappedFile::map_from_fd_and_close(int fd, [[maybe_unused]] StringView path, Mode mode)
 {
 {
     ScopeGuard fd_close_guard = [fd] {
     ScopeGuard fd_close_guard = [fd] {
-        ::close(fd);
+        (void)System::close(fd);
     };
     };
 
 
     auto stat = TRY(Core::System::fstat(fd));
     auto stat = TRY(Core::System::fstat(fd));