summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/sys/mprotect.231
1 files changed, 28 insertions, 3 deletions
diff --git a/lib/libc/sys/mprotect.2 b/lib/libc/sys/mprotect.2
index 51d1b14..48fcb32 100644
--- a/lib/libc/sys/mprotect.2
+++ b/lib/libc/sys/mprotect.2
@@ -40,6 +40,7 @@
.Sh SYNOPSIS
.Fd #include <sys/types.h>
.Fd #include <sys/mman.h>
+.Ft int
.Fn mprotect "caddr_t addr" "size_t len" "int prot"
.Sh DESCRIPTION
The
@@ -49,11 +50,35 @@ changes the specified pages to have protection
.Fa prot .
Not all implementations will guarantee protection on a page basis;
the granularity of protection changes may be as large as an entire region.
+.Sh RETURN VALUES
+Upon successful completion,
+.Fn mprotect
+returns 0. Otherwise a value of -1 is returned
+and
+.Va errno
+is set to indicate the error.
+.Sh ERRORS
+The
+.Fn mprotect
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The virtual address range specified by the
+.Fa addr
+and
+.Fa len
+arguments is not valid.
+.It Bq Er EACCES
+The calling process was not allowed to change
+the protection to the value specified by
+the
+.Fa prot
+argument.
.Sh SEE ALSO
-.Xr msync 2 ,
-.Xr munmap 2 ,
.Xr madvise 2 ,
-.Xr mincore 2
+.Xr mincore 2 ,
+.Xr msync 2 ,
+.Xr munmap 2
.Sh HISTORY
The
.Fn mprotect
OpenPOWER on IntegriCloud