diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2017-08-06 02:37:25 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-08-06 02:37:25 +0200 |
commit | 21771f338d268e06dc9a10b9b08b14ff8217d4be (patch) | |
tree | 1d23db3c6e7e995724af6b958959d33c96a02c66 /src/shared/bus-util.c | |
parent | test-condition: fix test_condition_test_group() (#6531) (diff) | |
download | systemd-21771f338d268e06dc9a10b9b08b14ff8217d4be.tar.xz systemd-21771f338d268e06dc9a10b9b08b14ff8217d4be.zip |
bus-util: do not print (uint64_t) -1 as is (#6522)
Closes #4295 and #6511.
Diffstat (limited to '')
-rw-r--r-- | src/shared/bus-util.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c index 7850aa60c7..1c6378f31a 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@ -39,10 +39,12 @@ #include "bus-label.h" #include "bus-message.h" #include "bus-util.h" +#include "cgroup-util.h" #include "def.h" #include "escape.h" #include "fd-util.h" #include "missing.h" +#include "mount-util.h" #include "nsflags.h" #include "parse-util.h" #include "proc-cmdline.h" @@ -746,7 +748,31 @@ int bus_print_property(const char *name, sd_bus_message *property, bool value, b } print_property(name, "%s", result); - } else + + } else if (streq(name, "MountFlags")) { + const char *result = NULL; + + result = mount_propagation_flags_to_string(u); + if (!result) + return -EINVAL; + + print_property(name, "%s", result); + + } 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) || + (STR_IN_SET(name, "MemoryCurrent", "TasksCurrent") && u == (uint64_t) -1) || + (endswith(name, "NSec") && u == (uint64_t) -1)) + + print_property(name, "%s", "[not set]"); + + else if ((STR_IN_SET(name, "MemoryLow", "MemoryHigh", "MemoryMax", "MemorySwapMax", "MemoryLimit") && u == CGROUP_LIMIT_MAX) || + (STR_IN_SET(name, "TasksMax", "DefaultTasksMax") && u == (uint64_t) -1) || + (startswith(name, "Limit") && u == (uint64_t) -1) || + (startswith(name, "DefaultLimit") && u == (uint64_t) -1)) + + print_property(name, "%s", "infinity"); + else print_property(name, "%"PRIu64, u); return 1; |