]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libc/gen/pmadvise.c
zfs: merge openzfs/zfs@2e2a46e0a
[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/cdefs.h>
8 #include <sys/mman.h>
9 #include <errno.h>
10
11 int
12 posix_madvise(void *address, size_t size, int how)
13 {
14         int ret, saved_errno;
15
16         saved_errno = errno;
17         if (madvise(address, size, how) == -1) {
18                 ret = errno;
19                 errno = saved_errno;
20         } else {
21                 ret = 0;
22         }
23         return (ret);
24 }