From 19a7f9fffb7c9962da5bbe4e6097c088f1efec23 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 29 May 2013 21:00:51 -0600 Subject: [PATCH] build: port qemu to cygwin A cygwin build of the qemu driver fails with: qemu/qemu_process.c: In function 'qemuPrepareCpumap': qemu/qemu_process.c:1803:31: error: 'CPU_SETSIZE' undeclared (first use in this function) CPU_SETSIZE is a Linux extension in ; a bit more portable is using sysconf if _SC_NPROCESSORS_CONF is defined (several platforms have it, including Cygwin). Ultimately, I would have preferred to use gnulib's 'nproc' module, but it is currently under an incompatible license. * src/qemu/qemu_conf.h (QEMUD_CPUMASK_LEN): Provide definition on cygwin. Signed-off-by: Eric Blake --- src/qemu/qemu_conf.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index df0791ec04..42566b4103 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -45,7 +45,13 @@ # include "locking/lock_manager.h" # include "qemu_capabilities.h" -# define QEMUD_CPUMASK_LEN CPU_SETSIZE +# ifdef CPU_SETSIZE /* Linux */ +# define QEMUD_CPUMASK_LEN CPU_SETSIZE +# elif defined(_SC_NPROCESSORS_CONF) /* Cygwin */ +# define QEMUD_CPUMASK_LEN (sysconf(_SC_NPROCESSORS_CONF)) +# else +# error "Port me" +# endif typedef struct _virQEMUCloseCallbacks virQEMUCloseCallbacks; typedef virQEMUCloseCallbacks *virQEMUCloseCallbacksPtr;