From b4aeef458c51b9debd394592e76b93cc6b00e0a2 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 18 Sep 1998 15:24:53 +0000 Subject: . --- acinclude.m4 | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'acinclude.m4') diff --git a/acinclude.m4 b/acinclude.m4 index 6fe4337f4..b6c1f656f 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -154,6 +154,50 @@ define(WK_CHECK_IPC, ]) +###################################################################### +# Check whether mlock is broken (hpux 10.20 raises a SIGBUS if mlock +# is not called from uid 0 (not tested whether uid 0 works) +###################################################################### +dnl WK_CHECK_MLOCK +dnl +define(WK_CHECK_MLOCK, + [ AC_CHECK_FUNCS(mlock) + if test "$ac_cv_func_mlock" = "yes"; then + AC_MSG_CHECKING(whether mlock is broken) + AC_TRY_RUN([ + #include + #include + #include + #include + #include + + int main() + { + char *pool; + int err; + long int pgsize = getpagesize(); + + 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 */ + } + + ], + AC_MSG_RESULT(no), + AC_DEFINE(HAVE_BROKEN_MLOCK) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(assuming no)) + fi + ]) + + ###################################################################### # progtest.m4 from gettext 0.35 ###################################################################### -- cgit v1.2.3