HP-UX Reference (11i v1 00/12) - 2 System Calls (vol 5)
__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man2/!!!intro.2
________________________________________________________________
___ ___
m
mprotect(2) mprotect(2)
HP-UX EXTENSIONS
SYNOPSIS
int mprotect(
caddr_t addr,
size_t len,
int prot );
DESCRIPTION
If the address range does not correspond to one created by a successful call to mmap(), mprotect()
returns an error. prot determines whether read, write, execute, or some combination of accesses are per-
mitted to the data being mapped.
If the address range being modified corresponds to a mapped file that was mapped with MAP_SHARED ,
mprotect() grants write access permission only if the file descriptor used to map the file was opened for
writing. If the address range corresponds to a mapped file that was mapped with the MAP_PRIVATE or
the MAP_ANONYMOUS
flag, mprotect() grants all requested access permissions.
For example, suppose an error occurs on some page at an addr2;
mprotect() may have modified the
protections of all whole pages in the range [addr,addr2].
ERRORS
[EINVAL] prot is invalid, or addr is not a multiple of the page size as returned by
sysconf(_SC_PAGE_SIZE)
.
[EFAULT] The range specified by [addr, addr+len] (from, and including, addr to, but not includ-
ing, addr+len) is invalid for a process’ address space, or the range specifies one or
more unmapped pages.
AUTHOR
mprotect() was developed by HP, AT&T, and OSF.
SEE ALSO
mmap(2), sysconf(2).
STANDARDS CONFORMANCE
mprotect(): AES, SVID3
HP-UX Release 11i: December 2000 − 1 − Section 2−−171
___
___