[libvirt] [PATCH v2] Include param.h in case of HAVE_BSD_CPU_AFFINITY

Guido Günther agx at sigxcpu.org
Mon Aug 11 10:23:05 UTC 2014


This fixes compilation on kFreeBSD which otherwise fails like

  CC       util/libvirt_util_la-virprocess.lo
In file included from /usr/include/sys/cpuset.h:35:0,
                 from util/virprocess.c:43:
/usr/include/sys/_cpuset.h:49:43: error: 'NBBY' undeclared here (not in
a function)
  long __bits[howmany(CPU_SETSIZE, _NCPUBITS)];
                                           ^
In file included from util/virprocess.c:43:0:
/usr/include/sys/cpuset.h:215:12: error: unknown type name 'cpusetid_t'
 int cpuset(cpusetid_t *);
            ^
/usr/include/sys/cpuset.h:216:30: error: expected ')' before 'id_t'
 int cpuset_setid(cpuwhich_t, id_t, cpusetid_t);
                              ^
/usr/include/sys/cpuset.h:217:42: error: expected ')' before 'id_t'
 int cpuset_getid(cpulevel_t, cpuwhich_t, id_t, cpusetid_t *);
                                          ^
/usr/include/sys/cpuset.h:218:48: error: expected ')' before 'id_t'
 int cpuset_getaffinity(cpulevel_t, cpuwhich_t, id_t, size_t, cpuset_t
*);
                                                ^
/usr/include/sys/cpuset.h:219:48: error: expected ')' before 'id_t'
 int cpuset_setaffinity(cpulevel_t, cpuwhich_t, id_t, size_t, const
cpuset_t *);

And it's the correct usage as documented in

  http://www.freebsd.org/cgi/man.cgi?query=cpuset_setid

Also change the #ifdef HAVE_BSH_CPU_AFFINITY to #if for consistency.
---

The previous version inluded sys/param.h twice causing make
syntax-check to fail.
 -- Guido

 src/util/virprocess.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index 9179d73..97cce4f 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -33,13 +33,16 @@
 #endif
 #include <sched.h>
 
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || HAVE_BSD_CPU_AFFINITY
 # include <sys/param.h>
+#endif
+
+#ifdef  __FreeBSD__
 # include <sys/sysctl.h>
 # include <sys/user.h>
 #endif
 
-#ifdef HAVE_BSD_CPU_AFFINITY
+#if HAVE_BSD_CPU_AFFINITY
 # include <sys/cpuset.h>
 #endif
 
-- 
2.0.1




More information about the libvir-list mailing list