diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2018-03-15 19:54:42 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2018-03-15 19:55:24 +0000 |
commit | 82b4be020e584aa3ec7288d22c6f956ed0a8c31c (patch) | |
tree | 9b471bc30581279b2f9524df4d6ed9aec493260c /usr/src/lib | |
parent | d8aa9216af8c1d23eaddba43fdd00ffe3f59da7a (diff) | |
download | illumos-joyent-82b4be020e584aa3ec7288d22c6f956ed0a8c31c.tar.gz |
OS-6665 Would like mechanism to determine how many vcpus bhyve supports
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Mike Gerdts <mike.gerdts@joyent.com>
Approved by: Patrick Mooney <patrick.mooney@joyent.com>
Diffstat (limited to 'usr/src/lib')
-rw-r--r-- | usr/src/lib/brand/bhyve/zone/bhhwcompat.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/usr/src/lib/brand/bhyve/zone/bhhwcompat.c b/usr/src/lib/brand/bhyve/zone/bhhwcompat.c index 8d8d10cf96..5f7a20feba 100644 --- a/usr/src/lib/brand/bhyve/zone/bhhwcompat.c +++ b/usr/src/lib/brand/bhyve/zone/bhhwcompat.c @@ -14,15 +14,19 @@ */ /* - * Exit 0 if the current hardware is bhyve-compatible, non-zero otherwise. - * A '-v' option can be used to print the incompatibility reason provided by - * the kernel. + * With no option, exit 0 if the current hardware is bhyve-compatible, non-zero + * otherwise. A '-v' option can be used to print the incompatibility reason + * provided by the kernel. + * + * The -c option can be used to print the number of virtual CPUs supported by + * bhyve build. */ #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <fcntl.h> +#include <sys/vmm.h> #include <sys/param.h> #include <sys/cpuset.h> @@ -32,7 +36,7 @@ static void usage() { - fprintf(stderr, "bhhwcompat [-v]\n"); + fprintf(stderr, "bhhwcompat [-cv]\n"); exit(1); } @@ -41,10 +45,14 @@ main(int argc, char *argv[]) { int fd, c; char emsg[128]; + boolean_t max_cpu = B_FALSE; boolean_t verbose = B_FALSE; - while ((c = getopt(argc, argv, "v")) != -1) { + while ((c = getopt(argc, argv, "cv")) != -1) { switch (c) { + case 'c': + max_cpu = B_TRUE; + break; case 'v': verbose = B_TRUE; break; @@ -53,6 +61,10 @@ main(int argc, char *argv[]) } } + if (max_cpu) { + (void) printf("%d\n", VM_MAXCPU); + } + if ((fd = open(VMM_CTL_DEV, O_RDONLY | O_EXCL)) < 0) { if (verbose) fprintf(stderr, "missing %s\n", VMM_CTL_DEV); |