support posix_madvise (previous a stub)
authorRich Felker <dalias@aerifal.cx>
Wed, 20 Apr 2011 19:25:28 +0000 (15:25 -0400)
committerRich Felker <dalias@aerifal.cx>
Wed, 20 Apr 2011 19:25:28 +0000 (15:25 -0400)
the check against MADV_DONTNEED to because linux MADV_DONTNEED
semantics conflict dangerously with the POSIX semantics

src/mman/posix_madvise.c

index 4727ad750e6c0af33b2285f11dc0f2e5f433acdf..b76f1a75a3f696e45984f8c8095bf0efdb42a0cf 100644 (file)
@@ -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);
 }