summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--misc-utils/lslocks.83
-rw-r--r--misc-utils/lslocks.c11
2 files changed, 9 insertions, 5 deletions
diff --git a/misc-utils/lslocks.8 b/misc-utils/lslocks.8
index 8881c8c57..04ece38e4 100644
--- a/misc-utils/lslocks.8
+++ b/misc-utils/lslocks.8
@@ -23,6 +23,9 @@ Print a help text and exit.
Specify which output columns to print. Use
.B "--help"
to get a list of all supported columns.
+
+The default list of the columns maybe be extended if the \fIlist\fP is
+specified in format +<list> (e.g. lslocks -o +BLOCKER).
.IP "\fB\-n, \-\-noheadings\fP"
Do not print a header line.
.IP "\fB\-u, \-\-notruncate\fP"
diff --git a/misc-utils/lslocks.c b/misc-utils/lslocks.c
index 7c0637bf0..de3094a01 100644
--- a/misc-utils/lslocks.c
+++ b/misc-utils/lslocks.c
@@ -521,6 +521,7 @@ int main(int argc, char *argv[])
{
int c, tt_flags = 0, rc = 0;
struct list_head locks;
+ char *outarg = NULL;
static const struct option long_opts[] = {
{ "pid", required_argument, NULL, 'p' },
{ "help", no_argument, NULL, 'h' },
@@ -545,11 +546,7 @@ int main(int argc, char *argv[])
pid = strtos32_or_err(optarg, _("invalid PID argument"));
break;
case 'o':
- ncolumns = string_to_idarray(optarg,
- columns, ARRAY_SIZE(columns),
- column_name_to_id);
- if (ncolumns < 0)
- return EXIT_FAILURE;
+ outarg = optarg;
break;
case 'V':
printf(UTIL_LINUX_VERSION);
@@ -586,6 +583,10 @@ int main(int argc, char *argv[])
columns[ncolumns++] = COL_PATH;
}
+ if (outarg && string_add_to_idarray(outarg, columns, ARRAY_SIZE(columns),
+ &ncolumns, column_name_to_id) < 0)
+ return EXIT_FAILURE;
+
rc = get_local_locks(&locks);
if (!rc && !list_empty(&locks))