master: Hack load_core_files by moving a static var
snuglas via Sbcl-commits <[email protected]> Fri, 31 Jul 2026 03:00:44 +0000
| Newsgroups | gmane.lisp.steel-bank.cvs |
|---|---|
| Message-ID | <[email protected]> |
The branch "master" has been updated in SBCL:
via 1285374c8c7ae0538d70803fae11c9f627cfb3ad (commit)
from 131e63dfc49f00304a6704abb240aa25f717d9bf (commit)
- Log -----------------------------------------------------------------
commit 1285374c8c7ae0538d70803fae11c9f627cfb3ad
Author: Douglas Katzman <[email protected]>
Date: Thu Jul 30 22:51:23 2026 -0400
Hack load_core_files by moving a static var
The purpose of this change is that if you expressly want to use read()
instead of mmap() to load core pages, you can set buggy_map_private=1
in your working copy. A reason to do this is that certain versions of
linux perf will only look in /tmp/perf-N.map if an unknown function is
not in a file-backed memory range. As the title says- it's a hack.
---
src/runtime/os-common.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/runtime/os-common.c b/src/runtime/os-common.c
index 262e645e3..0f6f4dea3 100644
--- a/src/runtime/os-common.c
+++ b/src/runtime/os-common.c
@@ -272,12 +272,12 @@ bool gc_managed_heap_space_p(lispobj addr)
void* load_core_bytes(int fd, os_vm_offset_t offset, os_vm_address_t addr, os_vm_size_t len,
int is_readonly_space)
{
+ static int buggy_map_private;
#if defined LISP_FEATURE_MIPS
/* Of the few MIPS machines I have access to, one definitely exhibits a
* horrible bug that mmap() persists MAP_PRIVATE pages back to disk,
* even though we alwayas open a core file as O_RDONLY. This is a kooky criterion
* to restrict the test by, but I didn't want it to be more general */
- static int buggy_map_private;
if (!buggy_map_private) {
struct utsname name;
uname(&name);
@@ -290,6 +290,7 @@ void* load_core_bytes(int fd, os_vm_offset_t offset, os_vm_address_t addr, os_vm
buggy_map_private = -1;
}
}
+#endif
if (buggy_map_private == 1) {
off_t old = lseek(fd, 0, SEEK_CUR);
lseek(fd, offset, SEEK_SET);
@@ -297,7 +298,6 @@ void* load_core_bytes(int fd, os_vm_offset_t offset, os_vm_address_t addr, os_vm
lseek(fd, old, SEEK_SET);
return addr;
}
-#endif
int fail = 0;
os_vm_address_t actual;
int protection = 0, sharing = MAP_PRIVATE;
-----------------------------------------------------------------------
hooks/post-receive
--
SBCL