chiark / gitweb /
bus: when the first char a server receives isn't the NUL byte immediately fail
[elogind.git] / src / cgtop / cgtop.c
index 9eb2d2fdebd108080ba9caaf2ecabb1acfed7880..eebebf033370c35c651dfe5cfbd07f0a219eb873 100644 (file)
@@ -31,6 +31,7 @@
 #include "hashmap.h"
 #include "cgroup-util.h"
 #include "build.h"
+#include "fileio.h"
 
 typedef struct Group {
         char *path;
@@ -443,11 +444,11 @@ static int display(Hashmap *a) {
 
         qsort(array, n, sizeof(Group*), group_compare);
 
-        rows = fd_lines(STDOUT_FILENO);
-        if (rows <= 0)
-                rows = 25;
+        rows = lines();
+        if (rows <= 10)
+                rows = 10;
 
-        path_columns = columns_uncached() - 42;
+        path_columns = columns() - 42;
         if (path_columns < 10)
                 path_columns = 10;
 
@@ -521,8 +522,8 @@ static void help(void) {
                "  -d --delay=DELAY    Specify delay\n"
                "  -n --iterations=N   Run for N iterations before exiting\n"
                "  -b --batch          Run in batch mode, accepting no input\n"
-               "     --depth=DEPTH    Maximum traversal depth (default: 2)\n",
-               program_invocation_short_name);
+               "     --depth=DEPTH    Maximum traversal depth (default: %d)\n",
+               program_invocation_short_name, arg_depth);
 }
 
 static void version(void) {
@@ -653,6 +654,8 @@ int main(int argc, char *argv[]) {
                 goto finish;
         }
 
+        signal(SIGWINCH, columns_lines_cache_reset);
+
         while (!quit) {
                 Hashmap *c;
                 usec_t t;