]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: debug: show boot and runtime process settings in table
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Sun, 22 Sep 2024 10:38:35 +0000 (12:38 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 24 Jan 2025 08:54:57 +0000 (09:54 +0100)
Let's reformat output of "show dev" in order to show some boot and runtime
process settings in a table. This makes the output less crowded.

src/debug.c

index 6434106a9a4df11ec51ded918c6d6b7158847104..a6a2c3f88ee92a27ab2c67f5b6fdd95b7bb6a40e 100644 (file)
@@ -596,12 +596,6 @@ static int debug_parse_cli_show_dev(char **args, char *payload, struct appctx *a
        for (i = 0; i < post_mortem.process.argc; i++)
                chunk_appendf(&trash, "%s ", post_mortem.process.argv[i]);
        chunk_appendf(&trash, "\n");
-
-       chunk_appendf(&trash, "  boot uid: %d\n", post_mortem.process.boot_uid);
-       chunk_appendf(&trash, "  runtime uid: %d\n", post_mortem.process.run_uid);
-       chunk_appendf(&trash, "  boot gid: %d\n", post_mortem.process.boot_gid);
-       chunk_appendf(&trash, "  runtime gid: %d\n", post_mortem.process.run_gid);
-
 #if defined(USE_LINUX_CAP)
        /* let's dump saved in feed_post_mortem() initial capabilities sets */
        if(!post_mortem.process.caps.err_boot) {
@@ -635,25 +629,25 @@ static int debug_parse_cli_show_dev(char **args, char *payload, struct appctx *a
                chunk_appendf(&trash, "  capget() failed at runtime with: %s.\n",
                              errname(post_mortem.process.caps.err_run, &err));
 #endif
-       chunk_appendf(&trash, "  boot limits:\n");
-       chunk_appendf(&trash, "  \tfd limit (soft): %s\n",
-                     LIM2A(normalize_rlim(post_mortem.process.boot_lim_fd.rlim_cur), "unlimited"));
-       chunk_appendf(&trash, "  \tfd limit (hard): %s\n",
-                     LIM2A(normalize_rlim(post_mortem.process.boot_lim_fd.rlim_max), "unlimited"));
-       chunk_appendf(&trash, "  \tram limit (soft): %s\n",
-                     LIM2A(normalize_rlim(post_mortem.process.boot_lim_ram.rlim_cur), "unlimited"));
-       chunk_appendf(&trash, "  \tram limit (hard): %s\n",
-                     LIM2A(normalize_rlim(post_mortem.process.boot_lim_ram.rlim_max), "unlimited"));
-
-       chunk_appendf(&trash, "  runtime limits:\n");
-       chunk_appendf(&trash, "  \tfd limit (soft): %s\n",
-                     LIM2A(normalize_rlim(post_mortem.process.run_lim_fd.rlim_cur), "unlimited"));
-       chunk_appendf(&trash, "  \tfd limit (hard): %s\n",
-                     LIM2A(normalize_rlim(post_mortem.process.run_lim_fd.rlim_max), "unlimited"));
-       chunk_appendf(&trash, "  \tram limit (soft): %s\n",
-                     LIM2A(normalize_rlim(post_mortem.process.run_lim_ram.rlim_cur), "unlimited"));
-       chunk_appendf(&trash, "  \tram limit (hard): %s\n",
-                     LIM2A(normalize_rlim(post_mortem.process.run_lim_ram.rlim_max), "unlimited"));
+
+       chunk_appendf(&trash, "  %-22s  %-11s  %-11s \n", "identity:", "-boot-", "-runtime-");
+       chunk_appendf(&trash, "  %-22s  %-11d  %-11d \n", "    uid:", post_mortem.process.boot_uid,
+                                                                     post_mortem.process.run_uid);
+       chunk_appendf(&trash, "  %-22s  %-11d  %-11d \n", "    gid:", post_mortem.process.boot_gid,
+                                                                     post_mortem.process.run_gid);
+       chunk_appendf(&trash, "  %-22s  %-11s  %-11s \n", "limits:", "-boot-", "-runtime-");
+       chunk_appendf(&trash, "  %-22s  %-11s  %-11s \n", "    fd limit (soft):",
+               LIM2A(normalize_rlim((ulong)post_mortem.process.boot_lim_fd.rlim_cur), "unlimited"),
+               LIM2A(normalize_rlim((ulong)post_mortem.process.run_lim_fd.rlim_cur), "unlimited"));
+       chunk_appendf(&trash, "  %-22s  %-11s  %-11s \n", "    fd limit (hard):",
+               LIM2A(normalize_rlim((ulong)post_mortem.process.boot_lim_fd.rlim_max), "unlimited"),
+               LIM2A(normalize_rlim((ulong)post_mortem.process.run_lim_fd.rlim_max), "unlimited"));
+       chunk_appendf(&trash, "  %-22s  %-11s  %-11s \n", "    ram limit (soft):",
+               LIM2A(normalize_rlim((ulong)post_mortem.process.boot_lim_ram.rlim_cur), "unlimited"),
+               LIM2A(normalize_rlim((ulong)post_mortem.process.run_lim_ram.rlim_cur), "unlimited"));
+       chunk_appendf(&trash, "  %-22s  %-11s  %-11s \n", "    ram limit (hard):",
+               LIM2A(normalize_rlim((ulong)post_mortem.process.boot_lim_ram.rlim_max), "unlimited"),
+               LIM2A(normalize_rlim((ulong)post_mortem.process.run_lim_ram.rlim_max), "unlimited"));
 
        ha_free(&err);