[rtems commit] posix: Add configure check for mprotect()

Sebastian Huber sebh at rtems.org
Fri Aug 10 05:15:33 UTC 2018


Module:    rtems
Branch:    master
Commit:    aac36d153aa88d666a2a6a7a4a49520e3aec7c17
Changeset: http://git.rtems.org/rtems/commit/?id=aac36d153aa88d666a2a6a7a4a49520e3aec7c17

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Aug  8 11:17:36 2018 +0200

posix: Add configure check for mprotect()

Update #3491.

---

 cpukit/configure.ac         | 10 ++++++++++
 cpukit/posix/src/mprotect.c |  4 ++++
 2 files changed, 14 insertions(+)

diff --git a/cpukit/configure.ac b/cpukit/configure.ac
index 17c47f4..1809973 100644
--- a/cpukit/configure.ac
+++ b/cpukit/configure.ac
@@ -116,6 +116,16 @@ RTEMS_CHECK_FUNC([pthread_getattr_np],[
   #include <pthread.h>])
 
 AC_LANG_PUSH(C)
+AC_MSG_CHECKING([for mprotect(const void *, ...)])
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+#include <sys/mman.h>
+int mprotect(const void *, size_t, int);
+])],[
+AC_MSG_RESULT([yes])
+AC_DEFINE(HAVE_MPROTECT_CONST, [], [mprotect(const void *, ...)])
+],[
+AC_MSG_RESULT([no])
+])
 AC_MSG_CHECKING([for pthread_mutex_getprioceiling(const pthread_mutex_t *, ...)])
 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
 #include <pthread.h>
diff --git a/cpukit/posix/src/mprotect.c b/cpukit/posix/src/mprotect.c
index 13017ce..76647c2 100644
--- a/cpukit/posix/src/mprotect.c
+++ b/cpukit/posix/src/mprotect.c
@@ -31,7 +31,11 @@
 #include <sys/mman.h>
 
 int mprotect(
+#ifdef HAVE_MPROTECT_CONST
   const void *addr,
+#else
+  void *addr,
+#endif
   size_t len,
   int prot
 )




More information about the vc mailing list