summaryrefslogtreecommitdiff
path: root/bin/ps/ps.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2004-11-24 19:17:11 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2004-11-24 19:17:11 +0000
commitb13a77bac3c17efa5913e41250ca5619f6df8fcf (patch)
tree236c575f90dc12dcf640dec2c0d791d11d43e06e /bin/ps/ps.c
parentc4ef6f658a0b2ff64a24b75de083f6e6e3430a1f (diff)
on MP machines, in STAT field, add /# where # is the cpu number so that
you can see processes move around; ok pval millert
Diffstat (limited to 'bin/ps/ps.c')
-rw-r--r--bin/ps/ps.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index 66089153613..435983d6eb1 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ps.c,v 1.39 2004/09/14 23:45:35 deraadt Exp $ */
+/* $OpenBSD: ps.c,v 1.40 2004/11/24 19:17:10 deraadt Exp $ */
/* $NetBSD: ps.c,v 1.15 1995/05/18 20:33:25 mycroft Exp $ */
/*-
@@ -40,7 +40,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.39 2004/09/14 23:45:35 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: ps.c,v 1.40 2004/11/24 19:17:10 deraadt Exp $";
#endif
#endif /* not lint */
@@ -80,6 +80,8 @@ int sumrusage; /* -S */
int termwidth; /* width of screen (0 == infinity) */
int totwidth; /* calculated width of requested variables */
+int ncpu = 1;
+
int needcomm, needenv, commandonly;
enum sort { DEFAULT, SORTMEM, SORTCPU } sortby = DEFAULT;
@@ -312,6 +314,12 @@ main(int argc, char *argv[])
what = KERN_PROC_ALL;
flag = 0;
}
+
+ mib[0] = CTL_HW;
+ mib[1] = HW_NCPU;
+ size = sizeof(ncpu);
+ (void) sysctl(mib, 2, &ncpu, &size, NULL, 0);
+
/*
* select procs
*/