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

RTEMS trac trac at rtems.org
Fri Dec 19 04:58:25 UTC 2014


#2078: sys/features.h ill-defines _POSIX_MEMLOCK and _POSIX_MEMLOCK_RANGE
----------------------+----------------------------
 Reporter:  strauman  |       Owner:  joel.sherrill
     Type:  defect    |      Status:  assigned
 Priority:  normal    |   Milestone:  4.11.1
Component:  Newlib    |     Version:  4.10
 Severity:  normal    |  Resolution:
 Keywords:            |
----------------------+----------------------------
Changes (by gedare):

 * owner:  ralf.corsepius => joel.sherrill
 * status:  new => assigned
 * milestone:  4.11 => 4.11.1


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:4>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list