Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/m/mprotect.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/m/mprotect.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/m/mprotect.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/m/mprotect.html on line 8

mprotect()

Change memory protection

Synopsis:

#include <sys/mman.h>

int mprotect( const void * addr, 
              size_t len,
              int prot );

Arguments:

addr
The beginning of the range of addresses whose protection you want to change.
len
The length of the range of addresses, in bytes.
prot
The new access capabilities for the mapped memory region(s). You can combine the following bits, which are defined in <sys/mman.h>:

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The mprotect() function changes the access protections on any mappings residing in the range starting at addr, and continuing for len bytes.

Returns:

0
Success.
-1
An error occurred (errno is set).

Note: If mprotect() fails, the protections on some of the pages in the address range starting at addr and continuing for len bytes may have been changed.

Errors:

EACCES
The memory object wasn't opened for read, regardless of the protection specified.

The memory object wasn't opened for write, and PROT_WRITE was specified for a MAP_SHARED type mapping.

EAGAIN
The prot argument specifies PROT_WRITE on a MAP_PRIVATE mapping, and there's insufficient memory resources to reserve for locking the private pages (if required).
ENOMEM
The addresses in the range starting at addr and continuing for len bytes are outside the range allowed for the address space of a process, or specify one or more pages that are not mapped.

The prot argument specifies PROT_WRITE on a MAP_PRIVATE mapping, and locking the private pages (if required) would need more space than the system can supply to reserve for doing so.

ENOSYS
The function mprotect() isn't supported by this implementation.

Classification:

POSIX 1003.1 MPR

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

mmap(), munmap(), shm_open(), shm_unlink()


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/m/mprotect.html on line 208

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/m/mprotect.html on line 208