From 58b5a8f3c057abe88e44385bb64904894f8fc49a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 29 Jul 2021 15:00:26 +0200 Subject: [PATCH] AK: Update mmap name for MappedFiles on SerenityOS Looking at process memory maps is a lot nicer when you can see the paths of MappedFile mappings. --- AK/MappedFile.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/AK/MappedFile.cpp b/AK/MappedFile.cpp index 9c3199d0fe..3957d042a3 100644 --- a/AK/MappedFile.cpp +++ b/AK/MappedFile.cpp @@ -37,6 +37,12 @@ Result, OSError> MappedFile::map(const String& path) if (ptr == MAP_FAILED) return OSError(errno); +#ifdef __serenity__ + if (set_mmap_name(ptr, size, path.characters()) < 0) { + perror("set_mmap_name"); + } +#endif + return adopt_ref(*new MappedFile(ptr, size)); }