]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libc/gen/pmadvise.c
zfs: merge openzfs/zfs@dbda45160
[FreeBSD/FreeBSD.git] / lib / libc / gen / pmadvise.c
1 /*
2  * The contents of this file are in the public domain.
3  * Written by Garrett A. Wollman, 2000-10-07.
4  *
5  */
6
7 #include <sys/mman.h>
8 #include <errno.h>
9
10 int
11 posix_madvise(void *address, size_t size, int how)
12 {
13         int ret, saved_errno;
14
15         saved_errno = errno;
16         if (madvise(address, size, how) == -1) {
17                 ret = errno;
18                 errno = saved_errno;
19         } else {
20                 ret = 0;
21         }
22         return (ret);
23 }