]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Check for KVM_API_VERSION at init
authorPekka Enberg <penberg@cs.helsinki.fi>
Mon, 22 Mar 2010 21:05:28 +0000 (23:05 +0200)
committerPekka Enberg <penberg@cs.helsinki.fi>
Mon, 22 Mar 2010 21:05:28 +0000 (23:05 +0200)
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
tools/kvm/kvm.c

index 1ea3ff840550746f08354f9b87c60f1e2c34936d..ed879120d2135e47d58efd770235e594b8a75ff9 100644 (file)
@@ -1,5 +1,6 @@
 #include "kvm/cpu.h"
 
+#include <linux/kvm.h>
 #include <stdlib.h>
 #include <fcntl.h>
 
@@ -23,12 +24,16 @@ static struct cpu *cpu__new(void)
 int main(int argc, char *argv[])
 {
        struct cpu *cpu;
-       int fd;
+       int fd, ret;
 
        fd = open("/dev/kvm", O_RDWR);
        if (fd < 0)
                die("open");
 
+       ret = ioctl(fd, KVM_GET_API_VERSION, 0);
+       if (ret != KVM_API_VERSION)
+               die("ioctl");
+
        cpu = cpu__new();
 
        cpu__reset(cpu);