diff options
author | bms <bms@FreeBSD.org> | 2003-08-09 03:23:24 +0000 |
---|---|---|
committer | bms <bms@FreeBSD.org> | 2003-08-09 03:23:24 +0000 |
commit | 5b3e496d6a0a70427a87083bee63722122ed9701 (patch) | |
tree | 9bd2e3958aed729b89eb0f7c0b3fb003f049354c /lib/libc/sys | |
parent | 5d2c6e8c37e32d5a6ba172b69829289710aaccfa (diff) | |
download | FreeBSD-src-5b3e496d6a0a70427a87083bee63722122ed9701.zip FreeBSD-src-5b3e496d6a0a70427a87083bee63722122ed9701.tar.gz |
Add the POSIX 1003.1-2001 posix_madvise() interface.
PR: standards/54634
Reviewed by: das
Approved by: jake (mentor)
Diffstat (limited to 'lib/libc/sys')
-rw-r--r-- | lib/libc/sys/Makefile.inc | 1 | ||||
-rw-r--r-- | lib/libc/sys/madvise.2 | 25 |
2 files changed, 25 insertions, 1 deletions
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 0c53319..ae536d5 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -119,6 +119,7 @@ MLINKS+=jail.2 jail_attach.2 MLINKS+=kqueue.2 kevent.2 MLINKS+=kse.2 kse_create.2 kse.2 kse_exit.2 kse.2 kse_release.2 \ kse.2 kse_wakeup.2 kse.2 kse_thr_interrupt.2 +MLINKS+=madvise.2 posix_madvise.2 MLINKS+=mlock.2 munlock.2 MLINKS+=modnext.2 modfnext.2 MLINKS+=mount.2 unmount.2 diff --git a/lib/libc/sys/madvise.2 b/lib/libc/sys/madvise.2 index d783ea0..25cb5c7 100644 --- a/lib/libc/sys/madvise.2 +++ b/lib/libc/sys/madvise.2 @@ -36,7 +36,7 @@ .Dt MADVISE 2 .Os .Sh NAME -.Nm madvise +.Nm madvise , posix_madvise .Nd give advice about use of memory .Sh LIBRARY .Lb libc @@ -44,12 +44,17 @@ .In sys/mman.h .Ft int .Fn madvise "void *addr" "size_t len" "int behav" +.Ft int +.Fn posix_madvise "void *addr" "size_t len" "int behav" .Sh DESCRIPTION The .Fn madvise system call allows a process that has knowledge of its memory behavior to describe it to the system. +The +.Fn posix_madvise +interface is identical and is provided for standards conformance. .Pp The known behaviors are: .Bl -tag -width MADV_SEQUENTIAL @@ -124,6 +129,15 @@ The process must have superuser privileges. This should be used judiciously in processes that must remain running for the system to properly function. .El +.Pp +Portable programs that call the +.Fn posix_madvise +interface should use the aliases +.Dv POSIX_MADV_NORMAL , POSIX_MADV_SEQUENTIAL , +.Dv POSIX_MADV_RANDOM , POSIX_MADV_WILLNEED , +and +.Dv POSIX_MADV_DONTNEED +rather than the flags described above. .Sh RETURN VALUES .Rv -std madvise .Sh ERRORS @@ -132,6 +146,10 @@ The system call will fail if: .Bl -tag -width Er .It Bq Er EINVAL +The +.Fa behav +argument is not valid. +.It Bq Er ENOMEM The virtual address range specified by the .Fa addr and @@ -146,6 +164,11 @@ was specified and the process does not have superuser privileges. .Xr mprotect 2 , .Xr msync 2 , .Xr munmap 2 +.Sh STANDARDS +The +.Fn posix_madvise +interface conforms to +.St -p1003.1-2001 . .Sh HISTORY The .Fn madvise |