git » libfiu » commit c30d735

preload/posix: Handle glibc's prototype of mprotect()

author Alberto Bertogli
2010-10-13 15:44:31 UTC
committer Alberto Bertogli
2010-10-13 15:44:31 UTC
parent 3b9e348a9d6af5c37e2e9a9d4ed4156e68710f11

preload/posix: Handle glibc's prototype of mprotect()

glibc's mprotect() does not take a const as its first argument, while the
standard says it should.

Our prototype did not have the const, which caused problems on some platforms
that have it (FreeBSD 8.1, for example).

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

preload/posix/modules/posix.mm.mod +8 -0

diff --git a/preload/posix/modules/posix.mm.mod b/preload/posix/modules/posix.mm.mod
index 443f816..6d96a93 100644
--- a/preload/posix/modules/posix.mm.mod
+++ b/preload/posix/modules/posix.mm.mod
@@ -24,9 +24,17 @@ int msync(void *addr, size_t length, int flags);
 	on error: -1
 	valid errnos: EBUSY EINVAL ENOMEM
 
+# glibc's mprotect() does not use const in the first argument, as the standard
+# says it should
+v: #ifdef __GLIBC__
 int mprotect(void *addr, size_t len, int prot);
 	on error: -1
 	valid errnos: EACCES EINVAL ENOMEM
+v: #else
+int mprotect(const void *addr, size_t len, int prot);
+	on error: -1
+	valid errnos: EACCES EINVAL ENOMEM
+v: #endif
 
 int madvise(void *addr, size_t length, int advice);
 	on error: -1