mirror of
https://github.com/clearlinux/kvmtool.git
synced 2026-09-01 11:15:57 +00:00
Check for KVM_API_VERSION at init
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
This commit is contained in:
committed by
Will Deacon
parent
b8f6afcd5e
commit
6c7d85141b
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user