mirror of
https://github.com/systemd/systemd.git
synced 2024-11-25 03:03:34 +08:00
Merge pull request #6707 from yuwata/systemctl-show-caps
systemctl: show capabilities in human readable format
This commit is contained in:
commit
deee5c648f
@ -1917,7 +1917,7 @@ int bus_exec_context_set_transient_property(
|
||||
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path %s is not absolute.", path);
|
||||
|
||||
if (mode != UNIT_CHECK) {
|
||||
char *buf = NULL;
|
||||
char *buf;
|
||||
|
||||
buf = strjoin(b ? "-" : "", path);
|
||||
if (!buf)
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "bus-label.h"
|
||||
#include "bus-message.h"
|
||||
#include "bus-util.h"
|
||||
#include "cap-list.h"
|
||||
#include "cgroup-util.h"
|
||||
#include "def.h"
|
||||
#include "escape.h"
|
||||
@ -733,7 +734,7 @@ int bus_print_property(const char *name, sd_bus_message *property, bool value, b
|
||||
print_property(name, "%s", format_timespan(timespan, sizeof(timespan), u, 0));
|
||||
} else if (streq(name, "RestrictNamespaces")) {
|
||||
_cleanup_free_ char *s = NULL;
|
||||
const char *result = NULL;
|
||||
const char *result;
|
||||
|
||||
if ((u & NAMESPACE_FLAGS_ALL) == 0)
|
||||
result = "yes";
|
||||
@ -750,7 +751,7 @@ int bus_print_property(const char *name, sd_bus_message *property, bool value, b
|
||||
print_property(name, "%s", result);
|
||||
|
||||
} else if (streq(name, "MountFlags")) {
|
||||
const char *result = NULL;
|
||||
const char *result;
|
||||
|
||||
result = mount_propagation_flags_to_string(u);
|
||||
if (!result)
|
||||
@ -758,6 +759,15 @@ int bus_print_property(const char *name, sd_bus_message *property, bool value, b
|
||||
|
||||
print_property(name, "%s", result);
|
||||
|
||||
} else if (STR_IN_SET(name, "CapabilityBoundingSet", "AmbientCapabilities")) {
|
||||
_cleanup_free_ char *s = NULL;
|
||||
|
||||
r = capability_set_to_string_alloc(u, &s);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
print_property(name, "%s", s);
|
||||
|
||||
} else if ((STR_IN_SET(name, "CPUWeight", "StartupCPUWeight", "IOWeight", "StartupIOWeight") && u == CGROUP_WEIGHT_INVALID) ||
|
||||
(STR_IN_SET(name, "CPUShares", "StartupCPUShares") && u == CGROUP_CPU_SHARES_INVALID) ||
|
||||
(STR_IN_SET(name, "BlockIOWeight", "StartupBlockIOWeight") && u == CGROUP_BLKIO_WEIGHT_INVALID) ||
|
||||
|
Loading…
Reference in New Issue
Block a user