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 __FBSDID("$FreeBSD$"); 9 10 #include <sys/mman.h> 11 #include <errno.h> 12 13 int 14 posix_madvise(void *address, size_t size, int how) 15 { 16 int ret, saved_errno; 17 18 saved_errno = errno; 19 if (madvise(address, size, how) == -1) { 20 ret = errno; 21 errno = saved_errno; 22 } else { 23 ret = 0; 24 } 25 return (ret); 26 } 27