mprotect() - change access protections on memory mappings
#include <sys/mman.h>
int mprotect(void *addr, size_t len, int prot)
The mprotect(2) call sets or changes the permissions on memory mappings in the address range [addr addr + len], rounded up to the next multiple of the page size.
The prot argument specifies the protections on the page, which are layered over the permissions. The protections are the same as for mmap(2). As defined in <sys/mman.h>:
If the call fails for a reason other than [EINVAL], it may mean that the permissions have been changed on the pages in the specified range.
The mprotect(2) call returns 0 for success, and -1 if an error occurred. If it returns -1, it sets errno to indicate the error.
mmap(2)
sysconf(2)