[Vm-dev] Call to Unix experts: how i can obtain a pointers to mmap/dlopen/dlsym functions?

Igor Stasenko siguctua at gmail.com
Sat Sep 25 01:14:19 UTC 2010


Hello,

i am currently trying to implement a bootstrap functionality for
NativeBoost on Linux.

And i need to access the mmap() function in order to be able to play
with virtual memory.

Things was easy in Windows, because i were able to get pointer to any
kernel function
using interpreterProxy
  ioLoadModuleOfLength(char*, int)
and
  void *ioLoadSymbolOfLengthFromModule(sqInt functionNameIndex, sqInt
functionNameLength, void *moduleHandle)

from Kernel32.dll.

But on Linux, mmap() is a part of GLIBC library.
Any idea, what module name i could use to get a pointer to
mmap/dlopen/dlsym using interpreterProxy functions?

By using pmap utility, i can see that squeak vm loads libc-2.10.1.so module:

sig at sig-desktop:/proc/14514$ pmap -x 14514
14514:   /home/sig/sqvm/build/squeakvm /home/sig/squeak/NativeBoost.image
Address   Kbytes     RSS    Anon  Locked Mode   Mapping
00110000    1272       -       -       - r-x--  libc-2.10.1.so
0024e000       8       -       -       - r----  libc-2.10.1.so
00250000       4       -       -       - rw---  libc-2.10.1.so


but it is on my box. And i having a strong suspicion, that it won't be
the same on different linux box :)
so i can't simply call

   ioLoadModuleOfLength('libc-2.10.1.so', strlen('libc-2.10.1.so'))

and be done.

Is there alias of some sort, which identifies standard C library?

I really don't like to adding primitives for getting pointers on these
functions :(

-- 
Best regards,
Igor Stasenko AKA sig.


More information about the Vm-dev mailing list