1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-19 10:53:58 +00:00

Output the value of all capabilities when the "--getcap" option is used without

a "--capname=<capname>". Do the same for the "--get-all" option.
This commit is contained in:
Neel Natu 2012-10-12 18:14:54 +00:00
parent 13f4cf6c6b
commit f570d5d113
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/bhyve/; revision=241487

View File

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