qemu-timer: remove active_timers array
[qemu.git] / qmp.c
blobbf58b05a9a2945944c8aa6d72fb5ee182937efd2
1 /*
2 * QEMU Management Protocol
4 * Copyright IBM, Corp. 2011
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
14 #include "qemu-common.h"
15 #include "sysemu.h"
16 #include "qmp-commands.h"
17 #include "kvm.h"
18 #include "arch_init.h"
20 NameInfo *qmp_query_name(Error **errp)
22 NameInfo *info = g_malloc0(sizeof(*info));
24 if (qemu_name) {
25 info->has_name = true;
26 info->name = g_strdup(qemu_name);
29 return info;
32 VersionInfo *qmp_query_version(Error **err)
34 VersionInfo *info = g_malloc0(sizeof(*info));
35 const char *version = QEMU_VERSION;
36 char *tmp;
38 info->qemu.major = strtol(version, &tmp, 10);
39 tmp++;
40 info->qemu.minor = strtol(tmp, &tmp, 10);
41 tmp++;
42 info->qemu.micro = strtol(tmp, &tmp, 10);
43 info->package = g_strdup(QEMU_PKGVERSION);
45 return info;
48 KvmInfo *qmp_query_kvm(Error **errp)
50 KvmInfo *info = g_malloc0(sizeof(*info));
52 info->enabled = kvm_enabled();
53 info->present = kvm_available();
55 return info;
58 UuidInfo *qmp_query_uuid(Error **errp)
60 UuidInfo *info = g_malloc0(sizeof(*info));
61 char uuid[64];
63 snprintf(uuid, sizeof(uuid), UUID_FMT, qemu_uuid[0], qemu_uuid[1],
64 qemu_uuid[2], qemu_uuid[3], qemu_uuid[4], qemu_uuid[5],
65 qemu_uuid[6], qemu_uuid[7], qemu_uuid[8], qemu_uuid[9],
66 qemu_uuid[10], qemu_uuid[11], qemu_uuid[12], qemu_uuid[13],
67 qemu_uuid[14], qemu_uuid[15]);
69 info->UUID = g_strdup(uuid);
70 return info;
73 void qmp_quit(Error **err)
75 no_shutdown = 0;
76 qemu_system_shutdown_request();
79 void qmp_stop(Error **errp)
81 vm_stop(RUN_STATE_PAUSED);
84 void qmp_system_reset(Error **errp)
86 qemu_system_reset_request();
89 void qmp_system_powerdown(Error **erp)
91 qemu_system_powerdown_request();