summaryrefslogtreecommitdiff
path: root/bin/ps/ps.c
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>2000-06-18 17:59:57 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>2000-06-18 17:59:57 +0000
commit3e1b0c93cbfea793e98b3b3bf7551399ede91f93 (patch)
treeb3afe1b2bd5097be03d5846b827f206f8539ac5f /bin/ps/ps.c
parent69a21ea0afdd021cb62f457b1cf6f2a69856ee12 (diff)
Mark kernel threads as system processes. Make ps hide them by default,
show them with -k. Do not try to show RSS based values for them as they mess up column alignment. vmstat -f now shows kernel threads separately from rforks too.
Diffstat (limited to 'bin/ps/ps.c')
-rw-r--r--bin/ps/ps.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index d2e3cc80d78..a4a639864a8 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ps.c,v 1.13 2000/04/16 02:19:55 ericj Exp $ */
+/* $OpenBSD: ps.c,v 1.14 2000/06/18 17:59:54 niklas Exp $ */
/* $NetBSD: ps.c,v 1.15 1995/05/18 20:33:25 mycroft Exp $ */
/*-
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: ps.c,v 1.13 2000/04/16 02:19:55 ericj Exp $";
+static char rcsid[] = "$OpenBSD: ps.c,v 1.14 2000/06/18 17:59:54 niklas Exp $";
#endif
#endif /* not lint */
@@ -116,7 +116,7 @@ main(argc, argv)
pid_t pid;
uid_t uid;
int all, ch, flag, i, fmt, lineno, nentries;
- int prtheader, wflag, what, xflg;
+ int prtheader, wflag, kflag, what, xflg;
char *nlistf, *memf, *swapf, errbuf[_POSIX2_LINE_MAX];
if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&ws) == -1 &&
@@ -130,13 +130,13 @@ main(argc, argv)
if (argc > 1)
argv[1] = kludge_oldps_options(argv[1]);
- all = fmt = prtheader = wflag = xflg = 0;
+ all = fmt = prtheader = wflag = kflag = xflg = 0;
pid = -1;
uid = (uid_t) -1;
ttydev = NODEV;
memf = nlistf = swapf = NULL;
while ((ch = getopt(argc, argv,
- "acCeghjLlM:mN:O:o:p:rSTt:U:uvW:wx")) != -1)
+ "acCeghjkLlM:mN:O:o:p:rSTt:U:uvW:wx")) != -1)
switch((char)ch) {
case 'a':
all = 1;
@@ -160,6 +160,9 @@ main(argc, argv)
fmt = 1;
jfmt[0] = '\0';
break;
+ case 'k':
+ kflag++;
+ break;
case 'L':
showkey();
exit(0);
@@ -310,6 +313,9 @@ main(argc, argv)
} else if (pid != -1) {
what = KERN_PROC_PID;
flag = pid;
+ } else if (kflag) {
+ what = KERN_PROC_KTHREAD;
+ flag = 0;
} else {
what = KERN_PROC_ALL;
flag = 0;