summaryrefslogtreecommitdiffstats
path: root/osdep-freebsd.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-02-08 12:31:02 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-02-08 12:31:02 +0000
commit505b071a12a5c2703cf1667e2ede0f44439bfe8f (patch)
tree80d20c9b36aad2e89218335be1f14f3607669180 /osdep-freebsd.c
parentdd962b60d0b6e8f81a5a5b396539d6aa8cd40f0c (diff)
More tweakery.
Diffstat (limited to 'osdep-freebsd.c')
-rw-r--r--osdep-freebsd.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/osdep-freebsd.c b/osdep-freebsd.c
index ef456422..8170a6c2 100644
--- a/osdep-freebsd.c
+++ b/osdep-freebsd.c
@@ -1,4 +1,4 @@
-/* $Id: osdep-freebsd.c,v 1.8 2009-02-07 19:33:07 nicm Exp $ */
+/* $Id: osdep-freebsd.c,v 1.9 2009-02-08 12:31:02 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -85,13 +85,31 @@ retry:
if (is_runnable(p) && !is_runnable(bestp))
bestp = p;
+ else if (!is_runnable(p) && is_runnable(bestp))
+ continue;
+
if (!is_stopped(p) && is_stopped(bestp))
bestp = p;
+ else if (is_stopped(p) && !is_stopped(bestp))
+ continue;
+
if (p->ki_estcpu > bestp->ki_estcpu)
bestp = p;
+ else if (p->ki_estcpu < bestp->ki_estcpu)
+ continue;
+
if (p->ki_slptime < bestp->ki_slptime)
bestp = p;
- /* XXX children? */
+ else if (p->ki_slptime > bestp->ki_slptime)
+ continue;
+
+ if (strcmp(p->ki_comm, p->ki_comm) < 0)
+ bestp = p;
+ else if (strcmp(p->ki_comm, p->ki_comm) > 0)
+ continue;
+
+ if (p->ki_pid > bestp->ki_pid)
+ bestp = p;
}
if (bestp != NULL) {
procname = get_proc_argv0(bestp->ki_pid);