Jelajahi Sumber

r2560 | honzaf | 2009-12-02 08:09:18 -0700 (Wed, 02 Dec 2009) | 8 lines

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/branches/flatiron@2615 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake 16 tahun lalu
induk
melakukan
3c91c87307
2 mengubah file dengan 11 tambahan dan 3 penghapusan
  1. 8 0
      configure.ac
  2. 3 3
      exec/main.c

+ 8 - 0
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],

+ 3 - 3
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");