hrev53144 adds 2 changesets to branch 'master'
old head: 44b903f97ac7e818ec623f8886aa984439ecbe6c
new head: ba390da3b4455b110ce94f8647478d38a7bbe928
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=ba390da3b445+%5E44b903f97ac7
----------------------------------------------------------------------------
dee722ce4fc8: runtime_loader: Optimize a special case of get_nearest_symbol.
If the caller does not want the symbol name/address/etc., we don't
need to spend the time finding it, and can just return after
finding the image.
Change-Id: I138f8bd4071ffc25738dac4d6c0c6d3fe25edf1c
Reviewed-on: https://review.haiku-os.org/c/1461
Reviewed-by: Adrien Destugues <pulkomandy@xxxxxxxxx>
ba390da3b445: libroot: Name mmap areas by the name of the image that allocated
them.
This adds an average overhead of 10-15 us, which seems acceptable
(without the previous patch it adds 200-250 us, which is less so),
and it makes "listarea" output much more enlightening for applications
like app_server or WebKit which use a lot of them.
Change-Id: I48a4148e6e9fb0d1a8bbf67294deeafad9372f44
Reviewed-on: https://review.haiku-os.org/c/1462
Reviewed-by: Adrien Destugues <pulkomandy@xxxxxxxxx>
[ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]
----------------------------------------------------------------------------
2 files changed, 26 insertions(+), 7 deletions(-)
src/system/libroot/posix/sys/mman.cpp | 15 ++++++++++++++-
src/system/runtime_loader/elf.cpp | 18 ++++++++++++------
############################################################################
Commit: dee722ce4fc86991b9bbccfc87d58b7db37d7623
URL: https://git.haiku-os.org/haiku/commit/?id=dee722ce4fc8
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Sat May 18 17:54:47 2019 UTC
Committer: waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Sat May 18 18:09:43 2019 UTC
runtime_loader: Optimize a special case of get_nearest_symbol.
If the caller does not want the symbol name/address/etc., we don't
need to spend the time finding it, and can just return after
finding the image.
Change-Id: I138f8bd4071ffc25738dac4d6c0c6d3fe25edf1c
Reviewed-on: https://review.haiku-os.org/c/1461
Reviewed-by: Adrien Destugues <pulkomandy@xxxxxxxxx>
----------------------------------------------------------------------------
diff --git a/src/system/runtime_loader/elf.cpp
b/src/system/runtime_loader/elf.cpp
index 916ed445cf..97855be79b 100644
--- a/src/system/runtime_loader/elf.cpp
+++ b/src/system/runtime_loader/elf.cpp
@@ -822,6 +822,18 @@ get_nearest_symbol_at_address(void* address, image_id*
_imageID,
if (image == NULL)
return B_BAD_VALUE;
+ if (_imageID != NULL)
+ *_imageID = image->id;
+ if (_imagePath != NULL)
+ *_imagePath = image->path;
+ if (_imageName != NULL)
+ *_imageName = image->name;
+
+ // If the caller does not want the actual symbol name, only the image,
+ // we can just return immediately.
+ if (_symbolName == NULL && _type == NULL && _location == NULL)
+ return B_OK;
+
bool exactMatch = false;
elf_sym* foundSymbol = NULL;
addr_t foundLocation = (addr_t)NULL;
@@ -845,12 +857,6 @@ get_nearest_symbol_at_address(void* address, image_id*
_imageID,
}
}
- if (_imageID != NULL)
- *_imageID = image->id;
- if (_imagePath != NULL)
- *_imagePath = image->path;
- if (_imageName != NULL)
- *_imageName = image->name;
if (_exactMatch != NULL)
*_exactMatch = exactMatch;
############################################################################
Revision: hrev53144
Commit: ba390da3b4455b110ce94f8647478d38a7bbe928
URL: https://git.haiku-os.org/haiku/commit/?id=ba390da3b445
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Sat May 18 18:00:35 2019 UTC
Committer: waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Sat May 18 18:09:43 2019 UTC
libroot: Name mmap areas by the name of the image that allocated them.
This adds an average overhead of 10-15 us, which seems acceptable
(without the previous patch it adds 200-250 us, which is less so),
and it makes "listarea" output much more enlightening for applications
like app_server or WebKit which use a lot of them.
Change-Id: I48a4148e6e9fb0d1a8bbf67294deeafad9372f44
Reviewed-on: https://review.haiku-os.org/c/1462
Reviewed-by: Adrien Destugues <pulkomandy@xxxxxxxxx>
----------------------------------------------------------------------------
diff --git a/src/system/libroot/posix/sys/mman.cpp
b/src/system/libroot/posix/sys/mman.cpp
index 53ec383990..bcbaee9ed5 100644
--- a/src/system/libroot/posix/sys/mman.cpp
+++ b/src/system/libroot/posix/sys/mman.cpp
@@ -8,11 +8,13 @@
#include <errno.h>
#include <fcntl.h>
+#include <stdio.h>
#include <string.h>
#include <pthread.h>
#include <OS.h>
+#include <runtime_loader/runtime_loader.h>
#include <errno_private.h>
#include <syscall_utils.h>
#include <syscalls.h>
@@ -130,8 +132,19 @@ mmap(void* address, size_t length, int protection, int
flags, int fd,
if ((protection & PROT_EXEC) != 0)
areaProtection |= B_EXECUTE_AREA;
+ // create a name for this area based on calling image
+ void* addr = __builtin_return_address(0);
+ char* imageName;
+ char areaName[B_OS_NAME_LENGTH];
+ status_t status = __gRuntimeLoader->get_nearest_symbol_at_address(
+ addr, NULL, NULL, &imageName, NULL, NULL, NULL, NULL);
+ if (status == B_OK)
+ snprintf(areaName, sizeof(areaName), "%s mmap area", imageName);
+ else
+ strlcpy(areaName, "mmap area", sizeof(areaName));
+
// ask the kernel to map
- area_id area = _kern_map_file("mmap area", &address, addressSpec,
+ area_id area = _kern_map_file(areaName, &address, addressSpec,
length, areaProtection, mapping, true, fd, offset);
if (area < 0) {
__set_errno(area);