Skip to content

Commit

Permalink
LibCore: Port MappedFile to Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
stasoid authored and gmta committed Nov 26, 2024
1 parent 153dc66 commit b3464d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Libraries/LibCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
4 changes: 1 addition & 3 deletions Libraries/LibCore/MappedFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
#include <LibCore/File.h>
#include <LibCore/MappedFile.h>
#include <LibCore/System.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>

namespace Core {

Expand All @@ -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)
{
ScopeGuard fd_close_guard = [fd] {
::close(fd);
(void)System::close(fd);
};

auto stat = TRY(Core::System::fstat(fd));
Expand Down

0 comments on commit b3464d0

Please sign in to comment.