int mprotect(void *addr, size_t len, int prot);
The system does not permit a write to succeed where PROT_WRITE has not been set or permit any access where PROT_NONE alone has been set. If PROT_WRITE is specified, the application must have opened the mapped objects in the specified address range with write permission, unless MAP_PRIVATE was specified in the original mapping. It is irrelevant whether the file descriptors used to map the objects have since been closed.
addr must be a multiple
of the page size as returned by
Is the starting address of the region for which the protection has to be changed.
Is the length of the region, in bytes, whose protection has to be changed.
Is the desired protection of the memory mapped region.
On success, the
The prot argument specifies a protection that violates the access permission the process has to the underlying memory object.
The prot argument specifies PROT_WRITE over a MAP_PRIVATE mapping and there are insufficient memory resources to reserve for locking the private page.
The addr argument is not a multiple of the page size as returned by
The len argument is has a value less than 0.
Addresses in the range [addr, addr + len] are invalid for the address space of a process, or specify one or more pages which are not mapped.
The prot argument specifies PROT_WRITE on a MAP_PRIVATE mapping, and it would require more space than the system is able to supply for locking the private pages, if required.
The implementation does not support the combination of accesses requested in the prot argument.
UNIX 98, with exceptions.
Windows 9x does not support the PROT_EXEC flag, nor does it
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC MKS Toolkit 10.3 Documentation Build 39.