]> xenbits.xensource.com Git - libvirt.git/commitdiff
maint: add configure checks for BSD CPU affinity
authorRoman Bogorodskiy <bogorodskiy@gmail.com>
Wed, 29 Jan 2014 18:31:44 +0000 (22:31 +0400)
committerEric Blake <eblake@redhat.com>
Wed, 29 Jan 2014 19:11:48 +0000 (12:11 -0700)
Check for presence of sys/cpuset.h header and cpuset_getaffinity()
in configure instead of just using #ifdef __FreeBSD__ for that code.

configure.ac
src/util/virprocess.c

index 3a703750100a16a6dac3b6115b4a690e78ce5c96..1670a4115a40133c8427e554741730a17053ca56 100644 (file)
@@ -2604,6 +2604,16 @@ AC_CHECK_DECLS([BRDGSFD, BRDGADD, BRDGDEL],
                 #include <net/if_bridgevar.h>
                ])
 
+# Check for BSD CPU affinity availability
+AC_CHECK_DECLS([cpuset_getaffinity],
+               [AC_DEFINE([HAVE_BSD_CPU_AFFINITY],
+                          [1],
+                          [whether BSD CPU affinity management is available])],
+               [],
+               [#include <sys/param.h>
+                #include <sys/cpuset.h>
+               ])
+
 # Check if we need to look for ifconfig
 if test "$want_ifconfig" = "yes"; then
      AC_PATH_PROG([IFCONFIG_PATH], [ifconfig])
index 827143c38945f3898098288bd6f851a146c18c72..83d0679e76b17f03c3f90ed9d923005bdd62bfb3 100644 (file)
 
 #ifdef __FreeBSD__
 # include <sys/param.h>
-# include <sys/cpuset.h>
 # include <sys/sysctl.h>
 # include <sys/user.h>
 #endif
 
+#ifdef HAVE_BSD_CPU_AFFINITY
+# include <sys/cpuset.h>
+#endif
+
 #include "viratomic.h"
 #include "virprocess.h"
 #include "virerror.h"
@@ -457,7 +460,7 @@ realloc:
     return 0;
 }
 
-#elif defined(__FreeBSD__)
+#elif defined(HAVE_BSD_CPU_AFFINITY)
 
 int virProcessSetAffinity(pid_t pid ATTRIBUTE_UNUSED,
                           virBitmapPtr map)