aboutsummaryrefslogtreecommitdiffstats
path: root/acinclude.m4
diff options
context:
space:
mode:
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m493
1 files changed, 48 insertions, 45 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 30eeb85d6..149a48506 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -384,18 +384,18 @@ define(GNUPG_CHECK_MLOCK,
#include <sys/mman.h>
#endif
], [
- int i;
-
- /* glibc defines this for functions which it implements
- * to always fail with ENOSYS. Some functions are actually
- * named something starting with __ and the normal name
- * is an alias. */
- #if defined (__stub_mlock) || defined (__stub___mlock)
- choke me
- #else
- mlock(&i, 4);
- #endif
- ; return 0;
+ int i;
+
+ /* glibc defines this for functions which it implements
+ * to always fail with ENOSYS. Some functions are actually
+ * named something starting with __ and the normal name
+ * is an alias. */
+ #if defined (__stub_mlock) || defined (__stub___mlock)
+ choke me
+ #else
+ mlock(&i, 4);
+ #endif
+ ; return 0;
],
gnupg_cv_mlock_is_in_sys_mman=yes,
gnupg_cv_mlock_is_in_sys_mman=no)])
@@ -406,42 +406,45 @@ define(GNUPG_CHECK_MLOCK,
fi
fi
if test "$ac_cv_func_mlock" = "yes"; then
+ AC_CHECK_FUNCS(sysconf getpagesize)
AC_MSG_CHECKING(whether mlock is broken)
AC_CACHE_VAL(gnupg_cv_have_broken_mlock,
AC_TRY_RUN([
- #include <stdlib.h>
- #include <unistd.h>
- #include <errno.h>
- #include <sys/mman.h>
- #include <sys/types.h>
- #include <fcntl.h>
-
- int main()
- {
- char *pool;
- int err;
- long int pgsize;
-
- #if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
- pgsize = sysconf(_SC_PAGESIZE);
- #elif defined(HAVE_GETPAGESIZE)
- pgsize = getpagesize();
- #endif
-
- if(pgsize==-1)
- pgsize = 4096;
-
- pool = malloc( 4096 + pgsize );
- if( !pool )
- return 2;
- pool += (pgsize - ((long int)pool % pgsize));
-
- err = mlock( pool, 4096 );
- if( !err || errno == EPERM )
- return 0; /* okay */
-
- return 1; /* hmmm */
- }
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <fcntl.h>
+
+int main()
+{
+ char *pool;
+ int err;
+ long int pgsize;
+
+#if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
+ pgsize = sysconf(_SC_PAGESIZE);
+#elif defined(HAVE_GETPAGESIZE)
+ pgsize = getpagesize();
+#else
+ pgsize = -1;
+#endif
+
+ if(pgsize==-1)
+ pgsize = 4096;
+
+ pool = malloc( 4096 + pgsize );
+ if( !pool )
+ return 2;
+ pool += (pgsize - ((long int)pool % pgsize));
+
+ err = mlock( pool, 4096 );
+ if( !err || errno == EPERM )
+ return 0; /* okay */
+
+ return 1; /* hmmm */
+}
],
gnupg_cv_have_broken_mlock="no",