summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2014-07-04 05:58:32 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2014-07-04 05:58:32 +0000
commit52dba0415f89a3472c9b55a4430bea6b67cd42ba (patch)
tree335922ad0dcfc3971b50111c921c495f0d6298ab /usr.bin
parentf5b56d633ad0f16a7046ad50606fd117803b93fd (diff)
Track whether a process is a zombie or not yet fully built via flags
PS_{ZOMBIE,EMBRYO} on the process instead of peeking into the process's thread data. This eliminates the need for the thread-level SDEAD state. Change kvm_getprocs() (both the sysctl() and kvm backends) to report the "most active" scheduler state for the process's threads. tweaks kettenis@ feedback and ok matthew@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/procname.c4
-rw-r--r--usr.bin/top/machine.c4
-rw-r--r--usr.bin/w/proc_compare.c4
-rw-r--r--usr.bin/w/w.c4
4 files changed, 8 insertions, 8 deletions
diff --git a/usr.bin/tmux/procname.c b/usr.bin/tmux/procname.c
index 4fb96038fe2..aeaf0fa49a3 100644
--- a/usr.bin/tmux/procname.c
+++ b/usr.bin/tmux/procname.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: procname.c,v 1.12 2014/04/16 23:05:38 nicm Exp $ */
+/* $OpenBSD: procname.c,v 1.13 2014/07/04 05:58:31 guenther Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -33,7 +33,7 @@
#define is_runnable(p) \
((p)->p_stat == SRUN || (p)->p_stat == SIDL || (p)->p_stat == SONPROC)
#define is_stopped(p) \
- ((p)->p_stat == SSTOP || (p)->p_stat == SZOMB || (p)->p_stat == SDEAD)
+ ((p)->p_stat == SSTOP || (p)->p_stat == SDEAD)
struct kinfo_proc *cmp_procs(struct kinfo_proc *, struct kinfo_proc *);
char *get_proc_name(int, char *);
diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c
index ac4baf74755..2d9bccba1e1 100644
--- a/usr.bin/top/machine.c
+++ b/usr.bin/top/machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machine.c,v 1.77 2014/04/08 14:04:11 mpi Exp $ */
+/* $OpenBSD: machine.c,v 1.78 2014/07/04 05:58:31 guenther Exp $ */
/*-
* Copyright (c) 1994 Thorsten Lockert <tholo@sigmasoft.com>
@@ -382,7 +382,7 @@ get_process_info(struct system_info *si, struct process_select *sel,
(show_threads || (pp->p_flag & P_THREAD) == 0)) {
total_procs++;
process_states[(unsigned char) pp->p_stat]++;
- if (pp->p_stat != SZOMB &&
+ if ((pp->p_psflags & PS_ZOMBIE) == 0 &&
(show_idle || pp->p_pctcpu != 0 ||
pp->p_stat == SRUN) &&
(!hide_uid || pp->p_ruid != sel->huid) &&
diff --git a/usr.bin/w/proc_compare.c b/usr.bin/w/proc_compare.c
index 4952157fad9..a2b280f9551 100644
--- a/usr.bin/w/proc_compare.c
+++ b/usr.bin/w/proc_compare.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc_compare.c,v 1.13 2012/12/18 21:28:45 millert Exp $ */
+/* $OpenBSD: proc_compare.c,v 1.14 2014/07/04 05:58:31 guenther Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -88,7 +88,7 @@ proc_compare(const struct kinfo_proc *p1, const struct kinfo_proc *p2)
/*
* weed out zombies
*/
- switch (TESTAB(p1->p_stat == SZOMB, p2->p_stat == SZOMB)) {
+ switch (TESTAB(p1->p_stat == SDEAD, p2->p_stat == SDEAD)) {
case ONLYA:
return (1);
case ONLYB:
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c
index a2955c656d9..4c146b81e87 100644
--- a/usr.bin/w/w.c
+++ b/usr.bin/w/w.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: w.c,v 1.54 2013/11/20 21:00:33 deraadt Exp $ */
+/* $OpenBSD: w.c,v 1.55 2014/07/04 05:58:31 guenther Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
@@ -221,7 +221,7 @@ main(int argc, char *argv[])
if (kp == NULL)
errx(1, "%s", kvm_geterr(kd));
for (i = 0; i < nentries; i++, kp++) {
- if (kp->p_stat == SIDL || kp->p_stat == SZOMB)
+ if (kp->p_psflags & (PS_EMBRYO | PS_ZOMBIE))
continue;
for (ep = ehead; ep != NULL; ep = ep->next) {
/* ftp is a special case. */