[RTEMS Project] #2078: sys/features.h ill-defines _POSIX_MEMLOCK and _POSIX_MEMLOCK_RANGE

RTEMS trac trac at rtems.org
Sat Nov 22 13:50:56 UTC 2014


#2078: sys/features.h ill-defines _POSIX_MEMLOCK and _POSIX_MEMLOCK_RANGE
----------------------+-----------------------------
 Reporter:  strauman  |       Owner:  ralf.corsepius
     Type:  defect    |      Status:  new
 Priority:  normal    |   Milestone:  4.10.3
Component:  Newlib    |     Version:  unspecified
 Severity:  normal    |  Resolution:
 Keywords:            |
----------------------+-----------------------------
Changes (by gedare):

 * milestone:  4.10 => 4.10.3


Old description:

> According to the linux manpage (I don't have access to a posix standard
> ATM):
>
>       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).)
>
> 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. BTW:
> the definition of _POSIX_MEMORY_PROTECTION also seems fishy.

New description:

 According to the linux manpage (I don't have access to a posix standard
 ATM):
       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).)
 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. BTW:
 the definition of _POSIX_MEMORY_PROTECTION also seems fishy.

--

--
Ticket URL: <http://devel.rtems.org/ticket/2078#comment:2>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list