[Bug 2078] sys/features.h ill-defines _POSIX_MEMLOCK and _POSIX_MEMLOCK_RANGE

bugzilla-daemon at rtems.org bugzilla-daemon at rtems.org
Tue Oct 9 05:31:53 UTC 2012


https://www.rtems.org/bugzilla/show_bug.cgi?id=2078

--- Comment #1 from Ralf Corsepius <ralf.corsepius at rtems.org> 2012-10-09 00:31:53 CDT ---
(In reply to comment #0)
> According to the linux manpage (I don't have access to a posix standard ATM):

POSIX can be found here: http://pubs.opengroup.org/onlinepubs/9699919799/


> 
>       On  POSIX  systems  on  which  mlock()  and  munlock()  are  available,
>        _POSIX_MEMLOCK_RANGE is defined in <unistd.h> and the number  of  bytes
>        in  a page can be determined from the constant PAGESIZE (if defined) in
>        <limits.h> or by calling sysconf(_SC_PAGESIZE).
> 
>        On POSIX systems on which mlockall() and  munlockall()  are  available,
>        _POSIX_MEMLOCK  is  defined  in  <unistd.h>  to a value greater than 0.
>        (See also sysconf(3).)

Well, ... this is the Linux interpretation of POSIX. 
As I understand the POSIX standard (c.f. above) it doesn't mandate this
specific interpretation, but leaves more room for interpretation.

> However, newlib's sys/feature.h defines
> 
> #ifdef __rtems__
> ...
> #define _POSIX_MEMLOCK          1
> #define _POSIX_MEMLOCK_RANGE        1
> #define _POSIX_MEMORY_PROTECTION    1
> ...
> #endif
> 
> which is wrong since RTEMS does *not* implement mlock nor mlockall.
Good catch - I agreed, newlib should not define these for RTEMS.
Could you please submit a patch to upstream newlib?

> BTW:
> the definition of _POSIX_MEMORY_PROTECTION also seems fishy.
Could you please file a separate bug for this issue, otherwise it's not
unlikely it will get lost?

-- 
Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the bugs mailing list