diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2014-07-10 13:42:54 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2014-07-10 13:42:54 +0000 |
commit | fc27ef60d168776f8f0e886964d69351e35c63a1 (patch) | |
tree | 9a30d73c6fb701fdb9b19eb190d68114d2ba91e9 /lib/libc | |
parent | 4a3ed803e70d39e97926a3039bb5ba3ec3b14582 (diff) |
posix_madvise() should return the errno value on error, not -1
ok tedu@ jmc@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/sys/madvise.2 | 15 | ||||
-rw-r--r-- | lib/libc/sys/posix_madvise.c | 5 |
2 files changed, 14 insertions, 6 deletions
diff --git a/lib/libc/sys/madvise.2 b/lib/libc/sys/madvise.2 index 40f7c0ad1b6..5f2238469b5 100644 --- a/lib/libc/sys/madvise.2 +++ b/lib/libc/sys/madvise.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: madvise.2,v 1.18 2014/07/02 22:22:35 matthew Exp $ +.\" $OpenBSD: madvise.2,v 1.19 2014/07/10 13:42:53 guenther Exp $ .\" $NetBSD: madvise.2,v 1.7 1995/12/27 21:17:02 jtc Exp $ .\" .\" Copyright (c) 1991, 1993 @@ -30,7 +30,7 @@ .\" .\" @(#)madvise.2 8.1 (Berkeley) 6/9/93 .\" -.Dd $Mdocdate: July 2 2014 $ +.Dd $Mdocdate: July 10 2014 $ .Dt MADVISE 2 .Os .Sh NAME @@ -51,7 +51,9 @@ allows a process that has knowledge of its memory behavior to describe it to the system. The .Fn posix_madvise -interface is identical and is provided for standards conformance. +interface has the same effect, but returns the error value +instead of only setting +.Va errno . .Pp The possible behaviors are: .Bl -tag -width MADV_SEQUENTIAL @@ -80,7 +82,12 @@ and .Dv POSIX_MADV_DONTNEED rather than the flags described above. .Sh RETURN VALUES -.Rv -std madvise posix_madvise +.Rv -std madvise +.Pp +If successful, the +.Fn posix_madvise +function will return zero. +Otherwise an error number will be returned to indicate the error. .Sh SEE ALSO .Xr mincore 2 , .Xr minherit 2 , diff --git a/lib/libc/sys/posix_madvise.c b/lib/libc/sys/posix_madvise.c index be310dbd7df..153c28223d1 100644 --- a/lib/libc/sys/posix_madvise.c +++ b/lib/libc/sys/posix_madvise.c @@ -1,13 +1,14 @@ -/* $OpenBSD: posix_madvise.c,v 1.2 2014/07/10 12:46:28 tedu Exp $ */ +/* $OpenBSD: posix_madvise.c,v 1.3 2014/07/10 13:42:53 guenther Exp $ */ /* * Ted Unangst wrote this file and placed it into the public domain. */ #include <sys/mman.h> +#include <errno.h> int _thread_sys_madvise(void *addr, size_t len, int behav); int posix_madvise(void *addr, size_t len, int behav) { - return (_thread_sys_madvise(addr, len, behav)); + return (_thread_sys_madvise(addr, len, behav) ? errno : 0); } |