freebsd-skq/lib/libc/gen/pmadvise.c
kib f0cb8e7d88 The posix_madvise(3) and posix_fadvise(2) should return error on
failure, same as posix_fallocate(2).

Noted by:	Bob Bishop <rb@gid.co.uk>
Discussed with:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2014-01-30 18:04:39 +00:00

27 lines
425 B
C

/*
* The contents of this file are in the public domain.
* Written by Garrett A. Wollman, 2000-10-07.
*
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/mman.h>
#include <errno.h>
int
posix_madvise(void *address, size_t size, int how)
{
int ret, saved_errno;
saved_errno = errno;
if (madvise(address, size, how) == -1) {
ret = errno;
errno = saved_errno;
} else {
ret = 0;
}
return (ret);
}