diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/Makefile.inc | 3 | ||||
-rw-r--r-- | lib/libc/gen/pmadvise.c | 4 | ||||
-rw-r--r-- | lib/libc/sys/Makefile.inc | 1 | ||||
-rw-r--r-- | lib/libc/sys/madvise.2 | 25 |
4 files changed, 29 insertions, 4 deletions
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc index 9ab8616..e26ed2f 100644 --- a/lib/libc/gen/Makefile.inc +++ b/lib/libc/gen/Makefile.inc @@ -19,7 +19,8 @@ SRCS+= __xuname.c _pthread_stubs.c _rand48.c _spinlock_stub.c _thread_init.c \ initgroups.c isatty.c jrand48.c lcong48.c \ lockf.c lrand48.c mrand48.c nice.c \ nlist.c nrand48.c ntp_gettime.c opendir.c \ - pause.c popen.c posixshm.c pselect.c psignal.c pw_scan.c pwcache.c \ + pause.c pmadvise.c popen.c posixshm.c pselect.c \ + psignal.c pw_scan.c pwcache.c \ raise.c readdir.c readpassphrase.c rewinddir.c \ scandir.c seed48.c seekdir.c semctl.c \ setdomainname.c sethostname.c setjmperr.c setmode.c \ diff --git a/lib/libc/gen/pmadvise.c b/lib/libc/gen/pmadvise.c index 4024d64..60cef63 100644 --- a/lib/libc/gen/pmadvise.c +++ b/lib/libc/gen/pmadvise.c @@ -10,7 +10,7 @@ __FBSDID("$FreeBSD$"); #include <sys/mman.h> int -(posix_madvise)(void *address, size_t size, int how) +posix_madvise(void *address, size_t size, int how) { - return posix_madvise(address, size, how); + return madvise(address, size, how); } 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 |