Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Oct 2012 18:14:54 +0000 (UTC)
From:      Neel Natu <neel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r241487 - projects/bhyve/usr.sbin/vmmctl
Message-ID:  <201210121814.q9CIEsIc052249@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: neel
Date: Fri Oct 12 18:14:54 2012
New Revision: 241487
URL: http://svn.freebsd.org/changeset/base/241487

Log:
  Output the value of all capabilities when the "--getcap" option is used without
  a "--capname=<capname>". Do the same for the "--get-all" option.

Modified:
  projects/bhyve/usr.sbin/vmmctl/vmmctl.c

Modified: projects/bhyve/usr.sbin/vmmctl/vmmctl.c
==============================================================================
--- projects/bhyve/usr.sbin/vmmctl/vmmctl.c	Fri Oct 12 17:39:28 2012	(r241486)
+++ projects/bhyve/usr.sbin/vmmctl/vmmctl.c	Fri Oct 12 18:14:54 2012	(r241487)
@@ -1479,14 +1479,27 @@ main(int argc, char *argv[])
 	}
 
 	if (!error && (getcap || get_all)) {
-		int captype, val;
-		captype = vm_capability_name2type(capname);
-		error = vm_get_capability(ctx, vcpu, captype, &val);
-		if (error == 0) {
-			printf("Capability \"%s\" is %s on vcpu %d\n", capname,
-				val ? "set" : "not set", vcpu);
-		} else if (errno == ENOENT) {
-			printf("Capability \"%s\" is not available\n", capname);
+		int captype, val, getcaptype;
+
+		if (getcap && capname)
+			getcaptype = vm_capability_name2type(capname);
+		else
+			getcaptype = -1;
+
+		for (captype = 0; captype < VM_CAP_MAX; captype++) {
+			if (getcaptype >= 0 && captype != getcaptype)
+				continue;
+			error = vm_get_capability(ctx, vcpu, captype, &val);
+			if (error == 0) {
+				printf("Capability \"%s\" is %s on vcpu %d\n",
+					vm_capability_type2name(captype),
+					val ? "set" : "not set", vcpu);
+			} else if (errno == ENOENT) {
+				printf("Capability \"%s\" is not available\n",
+					vm_capability_type2name(captype));
+			} else {
+				break;
+			}
 		}
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210121814.q9CIEsIc052249>