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 4727ad7..b76f1a7 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);
 }