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:
parent
13f4cf6c6b
commit
f570d5d113
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/projects/bhyve/; revision=241487
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user