[systemd-devel] [PATCH] systemctl: clean up output a little bit

Shawn Landden shawn at churchofgit.com
Tue Mar 31 11:52:33 PDT 2015


---
 src/systemctl/systemctl.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 3158a38..bf279f9 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -4133,6 +4133,57 @@ static int print_property(const char *name, sd_bus_message *m, const char *conte
                 }
 
                 break;
+
+        case SD_BUS_TYPE_UINT64:
+                   /* alternatively we could print these as "infinity" like CPUQuotaPerSecUSec */
+                if (startswith(name, "Limit") ||
+                    streq(name, "CPUShares") ||
+                    streq(name, "StartupCPUShares") ||
+                    streq(name, "BlockIOWeight") ||
+                    streq(name, "StartupBlockIOWeight") ||
+                    /* confusing that "MemoryCurrent" could be UINT64_MAX */
+                    streq(name, "MemoryCurrent") ||
+                    streq(name, "MemoryLimit") ||
+
+                    streq(name, "CapabilityBoundingSet")) {
+                        uint64_t u64;
+
+                        r = sd_bus_message_read_basic(m, 't', &u64);
+                        if (r < 0)
+                                return bus_log_parse_error(r);
+
+                        if ((u64 != (uint64_t) - 1) || arg_all)
+                                printf("%s=%"PRIu64"\n", name, u64);
+
+                        return 0;
+
+                }
+
+                break;
+
+        case SD_BUS_TYPE_BOOLEAN:
+
+                if (endswith(name, "Accounting") ||
+                    startswith(name, "Private") ||
+                    streq(name, "NoNewPrivileges") ||
+                    streq(name, "NonBlocking") ||
+                    streq(name, "CPUSchedulingResetOnFork") ||
+                    streq(name, "Delegate") ||
+                    streq(name, "Transient")) {
+                        bool b;
+
+                        r = sd_bus_message_read_basic(m, 'b', &b);
+                        if (r < 0)
+                                return bus_log_parse_error(r);
+
+                        if ((b == true) || arg_all)
+                                printf("%s=%s\n", name, yes_no(b));
+
+                        return 0;
+
+                }
+
+                break;
         }
 
         r = bus_print_property(name, m, arg_all);
-- 
2.2.1.209.g41e5f3a



More information about the systemd-devel mailing list