diff options
author | mpp <mpp@FreeBSD.org> | 1997-01-11 22:51:27 +0000 |
---|---|---|
committer | mpp <mpp@FreeBSD.org> | 1997-01-11 22:51:27 +0000 |
commit | 0d991be0429564ed73e02ac910ed866bb4c6345c (patch) | |
tree | 92cb1a6a0c4123a31de957e67018c7a5276fc50f /lib/libc/sys | |
parent | 6df94e5f56cc288a0cb02b382165230a4d1ae91c (diff) | |
download | FreeBSD-src-0d991be0429564ed73e02ac910ed866bb4c6345c.zip FreeBSD-src-0d991be0429564ed73e02ac910ed866bb4c6345c.tar.gz |
Some mdoc cleanup. Also added a RETURN VALUES and ERRORS
section.
Part of PR# 1493.
Diffstat (limited to 'lib/libc/sys')
-rw-r--r-- | lib/libc/sys/madvise.2 | 67 |
1 files changed, 45 insertions, 22 deletions
diff --git a/lib/libc/sys/madvise.2 b/lib/libc/sys/madvise.2 index ad1e000..9d6576a 100644 --- a/lib/libc/sys/madvise.2 +++ b/lib/libc/sys/madvise.2 @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)madvise.2 8.1 (Berkeley) 6/9/93 -.\" $Id$ +.\" $Id: madvise.2,v 1.7 1996/10/05 22:26:39 wosch Exp $ .\" .Dd Jul 19, 1996 .Dt MADVISE 2 @@ -41,6 +41,7 @@ .Sh SYNOPSIS .Fd #include <sys/types.h> .Fd #include <sys/mman.h> +.Ft int .Fn madvise "caddr_t addr" "size_t len" "int behav" .Sh DESCRIPTION The @@ -49,7 +50,7 @@ system call allows a process that has knowledge of its memory behavior to describe it to the system. The known behaviors are given in -.Pa <sys/mman.h> : +.Aq Pa sys/mman.h : .Bd -literal #define MADV_NORMAL 0 /* no further special treatment */ #define MADV_RANDOM 1 /* expect random page references */ @@ -58,17 +59,19 @@ The known behaviors are given in #define MADV_DONTNEED 4 /* don't need these pages */ #define MADV_FREE 5 /* data is now unimportant */ .Ed -.sp -MADV_NORMAL tells the system to revert to the default paging +.Pp +.Bl -tag -width MADV_SEQUENTIAL +.It Dv MADV_NORMAL +Tells the system to revert to the default paging behavior. -.sp -MADV_RANDOM is a hint that pages will be accessed randomly, and prefetching +.It Dv MADV_RANDOM +Is a hint that pages will be accessed randomly, and prefetching is likely not advantageous. -.sp -MADV_SEQUENTIAL causes the VM system to depress the priority of +.It Dv MADV_SEQUENTIAL +Causes the VM system to depress the priority of pages immediately preceeding a given page when it is faulted in. -.sp -MADV_WILLNEED causes pages that are in a given virtual address range +.It Dv MADV_WILLNEED +Causes pages that are in a given virtual address range to temporarily have higher priority, and if they are in memory, decrease the likelihood of them being freed. Additionally, the pages that are already in memory will be immediately mapped into @@ -76,27 +79,47 @@ the process, thereby eliminating unnecessary overhead of going through the entire process of faulting the pages in. This WILL NOT fault pages in from backing store, but quickly map the pages already in memory into the calling process. -.sp -MADV_DONTNEED allows the VM system to decrease the in-memory priority +.It Dv MADV_DONTNEED +Allows the VM system to decrease the in-memory priority of pages in the specified range. Additionally future references to this address range will incur a page fault. -.sp -MADV_FREE gives the VM system the freedom to free pages, +.Dv MADV_FREE +gives the VM system the freedom to free pages, and tells the system that information in the specified page range -is no longer important. This is an efficient way of allowing malloc(3) to -free pages anywhere in the address space, while keeping the address space +is no longer important. This is an efficient way of allowing +.Xr malloc 3 +to free pages anywhere in the address space, while keeping the address space valid. The next time that the page is referenced, the page might be demand -zeroed, or might contain the data that was there before the MADV_FREE call. +zeroed, or might contain the data that was there before the +.Dv MADV_FREE +call. References made to that address space range will not make the VM system page the information back in from backing store until the page is modified again. - +.El +.Sh RETURN VALUES +Upon successful completion, +.Fn madvise +returns 0. Otherwise a value of -1 is returned and +.Va errno +is set to indicate the error. +.Sh ERRORS +The +.Fn madvise +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. +.El .Sh SEE ALSO -.Xr msync 2 , -.Xr munmap 2 , +.Xr mincore 2 , .Xr mprotect 2 , -.Xr mincore 2 . - +.Xr msync 2 , +.Xr munmap 2 . .Sh HISTORY The .Fn madvise |