2001-01-23 04:49:39 +00:00
|
|
|
/*
|
|
|
|
* The contents of this file are in the public domain.
|
|
|
|
* Written by Garrett A. Wollman, 2000-10-07.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2002-02-01 00:57:29 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
2001-01-23 04:49:39 +00:00
|
|
|
#include <sys/mman.h>
|
2014-01-30 18:04:39 +00:00
|
|
|
#include <errno.h>
|
2001-01-23 04:49:39 +00:00
|
|
|
|
|
|
|
int
|
2003-08-09 03:23:24 +00:00
|
|
|
posix_madvise(void *address, size_t size, int how)
|
2001-01-23 04:49:39 +00:00
|
|
|
{
|
2014-01-30 18:04:39 +00:00
|
|
|
int ret, saved_errno;
|
|
|
|
|
|
|
|
saved_errno = errno;
|
|
|
|
if (madvise(address, size, how) == -1) {
|
|
|
|
ret = errno;
|
|
|
|
errno = saved_errno;
|
|
|
|
} else {
|
|
|
|
ret = 0;
|
|
|
|
}
|
|
|
|
return (ret);
|
2001-01-23 04:49:39 +00:00
|
|
|
}
|