aboutsummaryrefslogtreecommitdiff
path: root/lib/libvmmapi/vmmapi.c
diff options
context:
space:
mode:
authorMarcelo Araujo <araujo@FreeBSD.org>2019-12-17 01:33:26 +0000
committerMarcelo Araujo <araujo@FreeBSD.org>2019-12-17 01:33:26 +0000
commita71dc724e4e5be75f8d56f225a6f3c2062fa2307 (patch)
treee10d8669de7638b41b83ebc9377b2051a51502cb /lib/libvmmapi/vmmapi.c
parent0d83f8dc1f924a87478de9c893c7de5e260e68dd (diff)
downloadsrc-a71dc724e4e5be75f8d56f225a6f3c2062fa2307.tar.gz
src-a71dc724e4e5be75f8d56f225a6f3c2062fa2307.zip
Attempt to load vmm(4) module before creating a guest using vm_create()
wrapper in libvmmapi. Submitted by: Rob Fairbanks <rob.fx907_gmail.com> Reviewed by: jhb MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D19400
Notes
Notes: svn path=/head/; revision=355838
Diffstat (limited to 'lib/libvmmapi/vmmapi.c')
-rw-r--r--lib/libvmmapi/vmmapi.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c
index 6cfba69e23c2..6f5062545e41 100644
--- a/lib/libvmmapi/vmmapi.c
+++ b/lib/libvmmapi/vmmapi.c
@@ -34,7 +34,9 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/ioctl.h>
+#include <sys/linker.h>
#include <sys/mman.h>
+#include <sys/module.h>
#include <sys/_iovec.h>
#include <sys/cpuset.h>
@@ -103,7 +105,11 @@ vm_device_open(const char *name)
int
vm_create(const char *name)
{
-
+ /* Try to load vmm(4) module before creating a guest. */
+ if (modfind("vmm") < 0) {
+ if (modfind("vmm") < 0)
+ kldload("vmm");
+ }
return (CREATE((char *)name));
}