From 9edbf61401101a8cf6ba295715841dcad329b71d Mon Sep 17 00:00:00 2001 From: Jan Friesse Date: Wed, 2 Dec 2009 15:09:18 +0000 Subject: [PATCH] bsd: Fix mlockall on FreeBSD version >= 8.0 FreeBSD version 8.0 and greater supports mlockall syscall correctly. So configure.ac is changed to detect FreeBSD version and main.c is changed to support it. Resolves: rhbz#513687 git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2560 fd59a12c-fef9-0310-b244-a6a79926bd2f --- configure.ac | 8 ++++++++ exec/main.c | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index dc78d1de..eb733eb3 100644 --- a/configure.ac +++ b/configure.ac @@ -263,6 +263,14 @@ case "$host_os" in OS_DYFLAGS="-export-dynamic" DARWIN_OPTS="" OS_LDL="" + case "$host_os" in + *freebsd[[234567]]*) + ;; + *freebsd*) + AC_DEFINE_UNQUOTED([COROSYNC_FREEBSD_GE_8], [1], + [Compiling for FreeBSD >= 8 platform]) + ;; + esac ;; *solaris*) AC_DEFINE_UNQUOTED([COROSYNC_SOLARIS], [1], diff --git a/exec/main.c b/exec/main.c index 951b13da..c27c7135 100644 --- a/exec/main.c +++ b/exec/main.c @@ -404,7 +404,7 @@ static void corosync_tty_detach (void) static void corosync_mlockall (void) { -#if !defined(COROSYNC_BSD) +#if !defined(COROSYNC_BSD) || defined(COROSYNC_FREEBSD_GE_8) int res; #endif struct rlimit rlimit; @@ -417,8 +417,8 @@ static void corosync_mlockall (void) setrlimit (RLIMIT_VMEM, &rlimit); #endif -#if defined(COROSYNC_BSD) - /* under FreeBSD a process with locked page cannot call dlopen +#if defined(COROSYNC_BSD) && !defined(COROSYNC_FREEBSD_GE_8) + /* under FreeBSD < 8 a process with locked page cannot call dlopen * code disabled until FreeBSD bug i386/93396 was solved */ log_printf (LOGSYS_LEVEL_WARNING, "Could not lock memory of service to avoid page faults\n");