summaryrefslogtreecommitdiffstats
path: root/osdep-openbsd.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-07-28 22:26:13 +0000
committerTiago Cunha <tcunha@gmx.com>2009-07-28 22:26:13 +0000
commit6043d9cf89ab96a2bd4f8e910ea72243ef91e044 (patch)
treec3795c457dfecdd61abdcd2a95c90054b1ffa58e /osdep-openbsd.c
parenta3fc9dee3235010bce4e8b183e4fdc375dd7b6b7 (diff)
Sync OpenBSD patchset 182:
Go to the next if the current best process is replaced, don't keep comparing it with itself. Also fix process name comparison.
Diffstat (limited to 'osdep-openbsd.c')
-rw-r--r--osdep-openbsd.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/osdep-openbsd.c b/osdep-openbsd.c
index 57a67371..518bc5c9 100644
--- a/osdep-openbsd.c
+++ b/osdep-openbsd.c
@@ -1,4 +1,4 @@
-/* $Id: osdep-openbsd.c,v 1.16 2009-06-26 15:31:15 nicm Exp $ */
+/* $Id: osdep-openbsd.c,v 1.17 2009-07-28 22:26:13 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -82,41 +82,48 @@ retry:
continue;
}
- if (is_runnable(p) && !is_runnable(bestp))
+ if (is_runnable(p) && !is_runnable(bestp)) {
bestp = p;
- else if (!is_runnable(p) && is_runnable(bestp))
+ continue;
+ } else if (!is_runnable(p) && is_runnable(bestp))
continue;
- if (!is_stopped(p) && is_stopped(bestp))
+ if (!is_stopped(p) && is_stopped(bestp)) {
bestp = p;
- else if (is_stopped(p) && !is_stopped(bestp))
+ continue;
+ } else if (is_stopped(p) && !is_stopped(bestp))
continue;
- if (p->p_estcpu > bestp->p_estcpu)
+ if (p->p_estcpu > bestp->p_estcpu) {
bestp = p;
- else if (p->p_estcpu < bestp->p_estcpu)
+ continue;
+ } else if (p->p_estcpu < bestp->p_estcpu)
continue;
- if (p->p_slptime < bestp->p_slptime)
+ if (p->p_slptime < bestp->p_slptime) {
bestp = p;
- else if (p->p_slptime > bestp->p_slptime)
+ continue;
+ } else if (p->p_slptime > bestp->p_slptime)
continue;
- if (p->p_flag & P_SINTR && !(bestp->p_flag & P_SINTR))
+ if (p->p_flag & P_SINTR && !(bestp->p_flag & P_SINTR)) {
bestp = p;
- else if (!(p->p_flag & P_SINTR) && bestp->p_flag & P_SINTR)
+ continue;
+ } else if (!(p->p_flag & P_SINTR) && bestp->p_flag & P_SINTR)
continue;
if (LIST_FIRST(&p->p_children) == NULL &&
- LIST_FIRST(&bestp->p_children) != NULL) /* XXX ugh */
+ LIST_FIRST(&bestp->p_children) != NULL) { /* XXX ugh */
bestp = p;
- else if (LIST_FIRST(&p->p_children) != NULL &&
+ continue;
+ } else if (LIST_FIRST(&p->p_children) != NULL &&
LIST_FIRST(&bestp->p_children) == NULL)
continue;
- if (strcmp(p->p_comm, p->p_comm) < 0)
+ if (strcmp(p->p_comm, bestp->p_comm) < 0) {
bestp = p;
- else if (strcmp(p->p_comm, p->p_comm) > 0)
+ continue;
+ } else if (strcmp(p->p_comm, bestp->p_comm) > 0)
continue;
if (p->p_pid > bestp->p_pid)