1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:37:35 +00:00

LibCore: Add MappedFile::map_from_file()

This method relies on `map_from_fd_and_close()` but takes a `File`
instead of a fd.
This commit is contained in:
Lucas CHOLLET 2023-01-14 19:57:29 -05:00 committed by Sam Atkins
parent 3a95c8111d
commit 5b6e93f96a
2 changed files with 8 additions and 1 deletions

View file

@ -10,7 +10,7 @@
#include <AK/Noncopyable.h>
#include <AK/NonnullRefPtr.h>
#include <AK/RefCounted.h>
#include <AK/Result.h>
#include <LibCore/Forward.h>
namespace Core {
@ -20,6 +20,7 @@ class MappedFile : public RefCounted<MappedFile> {
public:
static ErrorOr<NonnullRefPtr<MappedFile>> map(StringView path);
static ErrorOr<NonnullRefPtr<MappedFile>> map_from_file(NonnullOwnPtr<Core::File>, StringView path);
static ErrorOr<NonnullRefPtr<MappedFile>> map_from_fd_and_close(int fd, StringView path);
~MappedFile();