mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 18:02:20 +00:00
LibCore: Port MappedFile to Windows
This commit is contained in:
parent
153dc6686c
commit
b3464d0645
Notes:
github-actions[bot]
2024-11-26 09:01:09 +00:00
Author: https://github.com/stasoid
Commit: b3464d0645
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2353
Reviewed-by: https://github.com/ADKaster ✅
2 changed files with 5 additions and 3 deletions
|
@ -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()
|
||||||
|
|
|
@ -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));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue