diff options
author | neel <neel@FreeBSD.org> | 2014-04-28 22:06:40 +0000 |
---|---|---|
committer | neel <neel@FreeBSD.org> | 2014-04-28 22:06:40 +0000 |
commit | b616a9a2e4a5c8e20ca308fb6e309583803cb19c (patch) | |
tree | 2a5755c72feac26b7524cca10dc7e5475e332ee8 /lib/libvmmapi/vmmapi.c | |
parent | 8820383a981da45b9f3593b94de0c67e3856d71c (diff) | |
download | FreeBSD-src-b616a9a2e4a5c8e20ca308fb6e309583803cb19c.zip FreeBSD-src-b616a9a2e4a5c8e20ca308fb6e309583803cb19c.tar.gz |
Allow a virtual machine to be forcibly reset or powered off. This is done
by adding an argument to the VM_SUSPEND ioctl that specifies how the virtual
machine should be suspended, viz. VM_SUSPEND_RESET or VM_SUSPEND_POWEROFF.
The disposition of VM_SUSPEND is also made available to the exit handler
via the 'u.suspended' member of 'struct vm_exit'.
This capability is exposed via the '--force-reset' and '--force-poweroff'
arguments to /usr/sbin/bhyvectl.
Discussed with: grehan@
Diffstat (limited to 'lib/libvmmapi/vmmapi.c')
-rw-r--r-- | lib/libvmmapi/vmmapi.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c index 60d3105..4a7f852 100644 --- a/lib/libvmmapi/vmmapi.c +++ b/lib/libvmmapi/vmmapi.c @@ -343,10 +343,13 @@ vm_run(struct vmctx *ctx, int vcpu, uint64_t rip, struct vm_exit *vmexit) } int -vm_suspend(struct vmctx *ctx) +vm_suspend(struct vmctx *ctx, enum vm_suspend_how how) { + struct vm_suspend vmsuspend; - return (ioctl(ctx->fd, VM_SUSPEND, 0)); + bzero(&vmsuspend, sizeof(vmsuspend)); + vmsuspend.how = how; + return (ioctl(ctx->fd, VM_SUSPEND, &vmsuspend)); } static int |