about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-04-20 15:25:28 -0400
committerRich Felker <dalias@aerifal.cx>2011-04-20 15:25:28 -0400
commit23573509244d4d5b4dc6d114b5807f72418f3411 (patch)
treea64ae975f50c00941fa8ac0df9ef9a7e10c0ea85
parent1c76683cb4377a481dc1085b63170bb276512267 (diff)
downloadmusl-23573509244d4d5b4dc6d114b5807f72418f3411.tar.gz
musl-23573509244d4d5b4dc6d114b5807f72418f3411.tar.xz
musl-23573509244d4d5b4dc6d114b5807f72418f3411.zip
support posix_madvise (previous a stub)
the check against MADV_DONTNEED to because linux MADV_DONTNEED
semantics conflict dangerously with the POSIX semantics
-rw-r--r--src/mman/posix_madvise.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mman/posix_madvise.c b/src/mman/posix_madvise.c
index 4727ad75..b76f1a75 100644
--- a/src/mman/posix_madvise.c
+++ b/src/mman/posix_madvise.c
@@ -1,6 +1,8 @@
+#define _GNU_SOURCE
 #include <sys/mman.h>
 
 int posix_madvise(void *addr, size_t len, int advice)
 {
-	return 0;
+	if (advice == MADV_DONTNEED) return 0;
+	return -__syscall(SYS_madvise, addr, len, advice);
 }