X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Flinux-os.c;h=026923ae15d81c4d2d21b8a32a99dbfd995d62fa;hb=03363f0145ab5e88a17a4b881068dc921f7d122f;hp=2b1dd2522af94fc3ad7efa1ca5c5d0332f0121c5;hpb=a499f2c9099d1dc2cb4227a2505eb4cc6f310e24;p=sbcl.git diff --git a/src/runtime/linux-os.c b/src/runtime/linux-os.c index 2b1dd25..026923a 100644 --- a/src/runtime/linux-os.c +++ b/src/runtime/linux-os.c @@ -36,6 +36,7 @@ #include "genesis/fdefn.h" #include #include +#include #include #include @@ -284,7 +285,14 @@ void os_protect(os_vm_address_t address, os_vm_size_t length, os_vm_prot_t prot) { if (mprotect(address, length, prot) == -1) { - perror("mprotect"); + if (errno == ENOMEM) { + lose("An mprotect call failed with ENOMEM. This probably means that the maximum amount\n" + "of separate memory mappings was exceeded. To fix the problem, either increase\n" + "the maximum with e.g. 'echo 262144 > /proc/sys/vm/max_map_count' or recompile\n" + "SBCL with a larger value for GENCGC-PAGE-SIZE in 'src/target/parms.lisp'."); + } else { + perror("mprotect"); + } } } @@ -370,3 +378,18 @@ os_install_interrupt_handlers(void) sig_stop_for_gc_handler); #endif } + +char * +os_get_runtime_executable_path() +{ + char path[PATH_MAX + 1]; + int size; + + size = readlink("/proc/self/exe", path, sizeof(path)-1); + if (size < 0) + return NULL; + else + path[size] = '\0'; + + return copied_string(path); +}