*lsns* lists information about all the currently accessible namespaces or about the given _namespace_. The _namespace_ identifier is an inode number.
-The default output is subject to change. So whenever possible, you should avoid using default outputs in your scripts. Always explicitly define expected columns by using the *--output* option together with a columns list in environments where a stable output is required.
+The default output is subject to change. So whenever possible, you should avoid using default outputs in your scripts. Always explicitly define expected output mode (*--tree* or *--list*) and columns by using the *--output* option together with a columns list in environments where a stable output is required.
The *NSFS* column, printed when *net* is specified for the *--type* option, is special; it uses multi-line cells. Use the option *--nowrap* to switch to ","-separated single-line representation.
*-W*, *--nowrap*::
Do not use multi-line text in columns.
-*-T*, *--nstree* _rel_::
+*-T*, *--tree* _rel_::
Use list output format.
-If *process* is gnve as _rel_, print proecss tree(s) in each name space.
+If *process* is given as _rel_, print proecss tree(s) in each name space. This is default when *--tree* is not specified.
If *parent* is given, print tree(s) constructed by the parent/child relationship.
If *owner* is given, print tree(s) constructed by the owner/owned relationship.
*owner* is used as default when _rel_ is omitted.
enum {
- LSNS_TREE_LIST,
+ LSNS_TREE_NONE,
LSNS_TREE_PROCESS,
LSNS_TREE_OWNER,
LSNS_TREE_PARENT,
unsigned int raw : 1,
json : 1,
tree : 2,
- list : 1,
no_trunc : 1,
no_headings: 1,
no_wrap : 1;
int main(int argc, char *argv[])
{
struct lsns ls;
- int c;
+ int c, force_list = 0;
int r = 0;
char *outarg = NULL;
enum {
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */
{ 'J','r' },
+ { 'l','T' },
{ 0 }
};
int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT;
ls.json = 1;
break;
case 'l':
- ls.list = 1;
+ force_list = 1;
break;
case 'o':
outarg = optarg;
if (ls.fltr_pid)
errx(EXIT_FAILURE, _("--task is mutually exclusive with <namespace>"));
ls.fltr_ns = strtou64_or_err(argv[optind], _("invalid namespace argument"));
- ls.tree = ls.list ? LSNS_TREE_LIST : LSNS_TREE_PROCESS;
+ if (!ls.tree && !force_list)
+ ls.tree = LSNS_TREE_PROCESS;
if (!ncolumns) {
columns[ncolumns++] = COL_PID;
columns[ncolumns++] = COL_NSFS;
}
columns[ncolumns++] = COL_COMMAND;
+
+ if (!ls.tree && !force_list)
+ ls.tree = LSNS_TREE_PROCESS;
}
if (outarg && string_add_to_idarray(outarg, columns, ARRAY_SIZE(columns),