[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnustep-cvs] r26723 - in /libs/base/trunk: ChangeLog Headers/Additi
From: |
David Ayers |
Subject: |
Re: [Gnustep-cvs] r26723 - in /libs/base/trunk: ChangeLog Headers/Additions/GNUstepBase/config.h.in Source/GSFFIInvocation.m configure configure.ac |
Date: |
Sun, 29 Jun 2008 23:11:44 +0200 |
User-agent: |
Mozilla-Thunderbird 2.0.0.14 (X11/20080509) |
Hubert Chathi schrieb:
> On Sun, 29 Jun 2008 09:54:56 +0200, David Ayers <address@hidden> said:
>
>> Hello David David Chisnall schrieb:
>>> I think calling mmap directly is the wrong solution here. You should
>>> be using valloc() with the requested size rounded up to the nearest
>>> page size, and then use mprotect to set it as executable. Note that
>>> most sane operating systems (and Vista) are moving to W^X, so you
>>> need to set it as writeable while creating it, then executable while
>>> using it (i.e. call mprotect immediately before the return).
>>>
>
>> My man page for vmalloc states:
>> The obsolete function valloc() allocates size bytes and returns
>> a pointer to the allocated memory. The memory address will be a
>> multiple of the page size. It is equivalent to
>> memalign(sysconf(_SC_PAGESIZE),size).
>
> Heh. My man page for memalign says:
> ,----
> | The obsolete function memalign() allocates size bytes and returns a
> | pointer to the allocated memory. The memory address will be a multiple
> | of boundary, which must be a power of two.
> `----
> and implies that posix_memalign should be used instead. From what I can
> gather, "ptr=valloc(size)" is equivalent to
> "posix_memalign(&ptr,sysconf(_SC_PAGESIZE),size)", but don't quote me on
> that.
I'm on lenny... so one could consider that a bug in the vmalloc man
page... would you care to open a bug report?
Cheers,
David