]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: show fd store info in status output
authorLennart Poettering <lennart@poettering.net>
Fri, 24 Mar 2023 21:37:42 +0000 (22:37 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 28 Mar 2023 04:40:14 +0000 (13:40 +0900)
The fdstore might pin a non-trivial amount of resources. Let's hence
display for services that enable it how many entries there are and what
the size limit is.

src/systemctl/systemctl-show.c

index 71bac12190df5718d5119831d0e5b73b13a11e05..fdc950a9e323717736f0b40c6aeebcdf0b9beb71 100644 (file)
@@ -207,6 +207,9 @@ typedef struct UnitStatusInfo {
         bool running:1;
         int status_errno;
 
+        uint32_t fd_store_max;
+        uint32_t n_fd_store;
+
         usec_t start_timestamp;
         usec_t exit_timestamp;
 
@@ -703,6 +706,9 @@ static void print_status_info(
                         printf("\n");
         }
 
+        if (i->n_fd_store > 0 || i->fd_store_max > 0)
+                printf("   FD Store: %u%s (limit: %u)%s\n", i->n_fd_store, ansi_grey(), i->fd_store_max, ansi_normal());
+
         if (i->memory_current != UINT64_MAX) {
                 printf("     Memory: %s", FORMAT_BYTES(i->memory_current));
 
@@ -1991,6 +1997,8 @@ static int show_one(
                 { "StatusText",                     "s",               NULL,           offsetof(UnitStatusInfo, status_text)                       },
                 { "PIDFile",                        "s",               NULL,           offsetof(UnitStatusInfo, pid_file)                          },
                 { "StatusErrno",                    "i",               NULL,           offsetof(UnitStatusInfo, status_errno)                      },
+                { "FileDescriptorStoreMax",         "u",               NULL,           offsetof(UnitStatusInfo, fd_store_max)                      },
+                { "NFileDescriptorStore",           "u",               NULL,           offsetof(UnitStatusInfo, n_fd_store)                        },
                 { "ExecMainStartTimestamp",         "t",               NULL,           offsetof(UnitStatusInfo, start_timestamp)                   },
                 { "ExecMainExitTimestamp",          "t",               NULL,           offsetof(UnitStatusInfo, exit_timestamp)                    },
                 { "ExecMainCode",                   "i",               NULL,           offsetof(UnitStatusInfo, exit_code)                         },