diff --git a/usr.bin/procstat/procstat.h b/usr.bin/procstat/procstat.h --- a/usr.bin/procstat/procstat.h +++ b/usr.bin/procstat/procstat.h @@ -44,6 +44,7 @@ PS_OPT_SIGNUM = 0x08, PS_OPT_VERBOSE = 0x10, PS_MODE_COMPAT = 0x20, + PS_MODE_NO_KINFO_PROC = 0x40, }; #define PS_SUBCOMMAND_OPTS \ diff --git a/usr.bin/procstat/procstat.c b/usr.bin/procstat/procstat.c --- a/usr.bin/procstat/procstat.c +++ b/usr.bin/procstat/procstat.c @@ -449,7 +449,8 @@ } /* Must specify either the -a flag or a list of pids. */ - if (!(aflag == 1 && argc == 0) && !(aflag == 0 && argc > 0)) + if (!(aflag == 1 && argc == 0) && !(aflag == 0 && argc > 0) && + (cmd->cmp & PS_MODE_NO_KINFO_PROC) == 0) usage(cmd); if (memf != NULL) @@ -465,6 +466,11 @@ xo_open_container(progname); xo_open_container(xocontainer); + if ((cmd->cmp & PS_MODE_NO_KINFO_PROC) != 0) { + cmd->cmd(prstat, NULL); + goto iter; + } + if (aflag) { p = procstat_getprocs(prstat, KERN_PROC_PROC, 0, &cnt); if (p == NULL) @@ -520,6 +526,7 @@ } } +iter: xo_close_container(xocontainer); xo_close_container(progname); xo_finish();