#367: optionally use mmap(2) to allocate the heap for safer usage of tospace-
locking
-----------------------------+----------------------------------------------
Reporter: felix | Owner:
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: core libraries | Version: 2.7
Resolution: | Keywords:
-----------------------------+----------------------------------------------
Comment (by Ivan Shmakov <address@hidden>):
Actually, I see no point in using mmap () just optionally iff
the tospace-locking feature was requested, provided that such a
feature is implemented on top of mprotect ().
In order to familiarise myself with the Chicken internals, and
to have some fun this evening as well, I've written the attached
patch.
I've successfully built Chicken with Chicken compiled with this
patch.
{{{
chicken $ mkdir +build-2 && cd +build-2/
+build-2 $ LC_ALL=C nohup time make -f ../Makefile srcdir=.. \
PREFIX=/nowhere/just/a/test ARCH=x86 PLATFORM=linux \
USE_HOST_PCRE=yes LOCKTOSPACE=yes -j 4 \
CHICKEN=../+build-1/chicken
...
+build-2 $ tail -n3 nohup.out
make[1]: Leaving directory `/.../+build-2'
414.38user 185.30system 2:33.85elapsed 389%CPU (0avgtext+0avgdata
0maxresident)k
0inputs+0outputs (0major+3712308minor)pagefaults 0swaps
+build-2 $ ./csi
CHICKEN
Version 3.0.0rc1 - linux-unix-gnu-x86 [ manyargs dload ptables applyhook
lockts hostpcre ]
(c)2000-2007 Felix L. Winkelmann compiled 2008-01-18 on [...]
(Linux)
#;1> ,q
+build-2 $
}}}
As a possible way to improve this further, I'd propose using a
struct like the following for `heapspace's:
{{{
struct {
C_byte *ptr;
#ifdef C_LOCK_TOSPACE
size_t size;
#endif
} heapspace1, heapspace2;
}}}
since `size' is required for munmap ().