This patch provides a function that process a cpu affinity list
in the form x,y,z... into a cpu_set_t variable.

Signed-off-by: Glauber Costa <[EMAIL PROTECTED]>
---
 qemu/vl.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/qemu/vl.c b/qemu/vl.c
index 6a94724..4715594 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -8646,6 +8646,23 @@ void *qemu_alloc_physram(unsigned long memory)
 
     return area;
 }
+#ifdef USE_KVM
+#include <sched.h>
+void process_cpu_set(const char *map, cpu_set_t *set)
+{
+    char *ptr = map;
+    int c;
+    CPU_ZERO(set);
+    do {
+        c = atoi(ptr);
+        CPU_SET(c, set);
+        ptr = strchr(ptr, ',');
+        if (!ptr)
+            break;
+        ptr++;
+    } while (*ptr);
+}
+#endif
 
 int main(int argc, char **argv)
 {
-- 
1.5.0.6


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to