svn commit: r241487 - projects/bhyve/usr.sbin/vmmctl

Neel Natu neel at FreeBSD.org
Fri Oct 12 18:14:54 UTC 2012


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;
+			}
 		}
 	}
 


More information about the svn-src-projects mailing list