pmadvise.c revision 261560
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: stable/10/lib/libc/gen/pmadvise.c 261560 2014-02-06 19:47:17Z kib $"); 9 10#include <sys/mman.h> 11#include <errno.h> 12 13int 14posix_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