From: Karel Zak Date: Wed, 6 Dec 2023 12:25:20 +0000 (+0100) Subject: lslocks: improve --list-columns X-Git-Tag: v2.40-rc1~122^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4173496f497459fbfc8f2da1f4fd325406c88357;p=thirdparty%2Futil-linux.git lslocks: improve --list-columns Signed-off-by: Karel Zak --- diff --git a/bash-completion/lslocks b/bash-completion/lslocks index fbe75fffad..2847d35962 100644 --- a/bash-completion/lslocks +++ b/bash-completion/lslocks @@ -40,6 +40,7 @@ _lslocks_module() --pid --raw --notruncate + --list-columns --help --version " diff --git a/misc-utils/lslocks.8.adoc b/misc-utils/lslocks.8.adoc index 1efdf7aefb..2084d96c05 100644 --- a/misc-utils/lslocks.8.adoc +++ b/misc-utils/lslocks.8.adoc @@ -35,7 +35,7 @@ lslocks - list local system locks include::man-common/in-bytes.adoc[] *-H*, *--list-columns*:: -List the available columns. +List the available columns, use with *--json* or *--raw* to get output in machine-readable format. *-i*, *--noinaccessible*:: Ignore lock files which are inaccessible for the current user. diff --git a/misc-utils/lslocks.c b/misc-utils/lslocks.c index 2881855589..2a88440b44 100644 --- a/misc-utils/lslocks.c +++ b/misc-utils/lslocks.c @@ -79,7 +79,7 @@ static struct colinfo infos[] = { [COL_SRC] = { "COMMAND",15, 0, N_("command of the process holding the lock") }, [COL_PID] = { "PID", 5, SCOLS_FL_RIGHT, N_("PID of the process holding the lock") }, [COL_TYPE] = { "TYPE", 5, SCOLS_FL_RIGHT, N_("kind of lock") }, - [COL_SIZE] = { "SIZE", 4, SCOLS_FL_RIGHT, N_("size of the lock. Use if -b/--bytes is given.") }, + [COL_SIZE] = { "SIZE", 4, SCOLS_FL_RIGHT, N_("size of the lock, use if --bytes is given") }, [COL_INODE] = { "INODE", 5, SCOLS_FL_RIGHT, N_("inode number") }, [COL_MAJMIN] = { "MAJ:MIN", 6, 0, N_("major:minor device number") }, [COL_MODE] = { "MODE", 5, 0, N_("lock access mode") }, @@ -833,10 +833,10 @@ static void __attribute__((__noreturn__)) usage(void) exit(EXIT_SUCCESS); } -static void __attribute__((__noreturn__)) list_colunms(const char *table_name, - FILE *out) +static void __attribute__((__noreturn__)) list_colunms(void) { - struct libscols_table *col_tb = xcolumn_list_table_new(table_name, out, raw, json); + struct libscols_table *col_tb = xcolumn_list_table_new( + "lslocks-columns", stdout, raw, json); for (size_t i = 0; i < ARRAY_SIZE(infos); i++) { if (i != COL_SIZE) { @@ -941,7 +941,7 @@ int main(int argc, char *argv[]) } if (collist) - list_colunms("lslocks-columns", stdout); /* print end exit */ + list_colunms(); /* print end exit */ INIT_LIST_HEAD(&proc_locks);