control the protection of pages
() system call sets the access
protections for the pages that contain the address range
1 (inclusive). If len
is 0, no action is
taken on the page that contains addr
The protections (region accessibility) are specified in the
argument. It should either be
(no permissions) or the bitwise
OR of one or more of the following values:
Not all implementations will guarantee protection on a page basis; the
granularity of protection changes may be as large as an entire region. Nor
will all implementations guarantee to give exactly the requested permissions;
more permissions may be granted than requested by
. However, if
was not specified then the page
will not be writable.
Upon successful completion, the value 0 is returned; otherwise the
value -1 is returned and the global variable
is set to indicate the error.
() will fail if:
- The process does not have sufficient access to the underlying memory
object to provide the requested protection.
- The process has locked future pages with
a page being protected is not currently accessible, and making it
accessible and locked would exceed process or system limits.
- The accesses requested in the prot
argument are not allowed. In particular,
mappings are not permitted in most binaries (see
sysctl(2) for more
- The prot argument is invalid or the
specified address range would wrap around.
() function conforms to
IEEE Std 1003.1-2008
() function first appeared in
() does not require
to be page-aligned, although other