]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lslocks: add --output-all option
authorSami Kerola <kerolasa@iki.fi>
Mon, 23 Apr 2018 21:02:48 +0000 (22:02 +0100)
committerSami Kerola <kerolasa@iki.fi>
Thu, 3 May 2018 18:56:20 +0000 (19:56 +0100)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
bash-completion/lslocks
misc-utils/lslocks.8
misc-utils/lslocks.c

index acc7b1ff6d59ec9b12b52c166d0aea2b11876b6a..fbe75fffadd9a1ff875b03d54b5dcce38c491132 100644 (file)
@@ -36,6 +36,7 @@ _lslocks_module()
                --noinaccessible
                --noheadings
                --output
+               --output-all
                --pid
                --raw
                --notruncate
index ba0f4475291bfe5f910ff6d8f7186de36566d1c1..40b2cebf67dc2cedae1d3f8bb45ff18a5678e197 100644 (file)
@@ -40,6 +40,9 @@ to get a list of all supported columns.
 The default list of columns may be extended if \fIlist\fP is
 specified in the format \fI+list\fP (e.g. \fBlslocks -o +BLOCKER\fP).
 .TP
+.B \-\-output\-all
+Output all available columns.
+.TP
 .BR \-p , " \-\-pid " \fIpid\fP
 Display only the locks held by the process with this \fIpid\fR.
 .TP
index 2427006f6063eb6aeb28e3c726fdfc43a2108826..f83fb76f2dcc36a647f8a0323f6b566ab5accadb 100644 (file)
@@ -536,6 +536,7 @@ static void __attribute__((__noreturn__)) usage(void)
        fputs(_(" -i, --noinaccessible   ignore locks without read permissions\n"), out);
        fputs(_(" -n, --noheadings       don't print headings\n"), out);
        fputs(_(" -o, --output <list>    define which output columns to use\n"), out);
+       fputs(_("     --output-all       output all columns\n"), out);
        fputs(_(" -p, --pid <pid>        display only locks held by this process\n"), out);
        fputs(_(" -r, --raw              use the raw output format\n"), out);
        fputs(_(" -u, --notruncate       don't truncate text in columns\n"), out);
@@ -558,12 +559,16 @@ int main(int argc, char *argv[])
        int c, rc = 0;
        struct list_head locks;
        char *outarg = NULL;
+       enum {
+               OPT_OUTPUT_ALL = CHAR_MAX + 1
+       };
        static const struct option long_opts[] = {
                { "bytes",      no_argument,       NULL, 'b' },
                { "json",       no_argument,       NULL, 'J' },
                { "pid",        required_argument, NULL, 'p' },
                { "help",       no_argument,       NULL, 'h' },
                { "output",     required_argument, NULL, 'o' },
+               { "output-all", no_argument,       NULL, OPT_OUTPUT_ALL },
                { "notruncate", no_argument,       NULL, 'u' },
                { "version",    no_argument,       NULL, 'V' },
                { "noheadings", no_argument,       NULL, 'n' },
@@ -603,6 +608,10 @@ int main(int argc, char *argv[])
                case 'o':
                        outarg = optarg;
                        break;
+               case OPT_OUTPUT_ALL:
+                       for (ncolumns = 0; ncolumns < ARRAY_SIZE(infos); ncolumns++)
+                               columns[ncolumns] = ncolumns;
+                       break;
                case 'V':
                        printf(UTIL_LINUX_VERSION);
                        return EXIT_SUCCESS;