bus-print-properties: ignore CGROUP_LIMIT_MAX for Memory*{Current,Peak}
authorMike Yuan <me@yhndnzj.com>
Fri, 24 Nov 2023 11:15:40 +0000 (19:15 +0800)
committerMike Yuan <me@yhndnzj.com>
Fri, 24 Nov 2023 15:22:41 +0000 (23:22 +0800)
MemoryCurrent and MemoryAvailable are shown as "[not set]" when UINT64_MAX
(unset). Let's do the same for the newly-added Memory*{Current,Peak} properties.

src/shared/bus-print-properties.c

index 8999a1a..62b9cf1 100644 (file)
@@ -158,6 +158,7 @@ static int bus_print_property(const char *name, const char *expected_value, sd_b
                            (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", "MemoryAvailable", "TasksCurrent") && u == UINT64_MAX) ||
+                           (startswith(name, "Memory") && ENDSWITH_SET(name, "Current", "Peak") && u == CGROUP_LIMIT_MAX) ||
                            (endswith(name, "NSec") && u == UINT64_MAX))
 
                         bus_print_property_value(name, expected_value, flags, "[not set]");