From 523b2e863f09ebf9462790d81882d94846829f55 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sat, 7 Feb 2009 19:27:11 +0000 Subject: [PATCH] Tweak FreeBSD too. --- osdep-freebsd.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/osdep-freebsd.c b/osdep-freebsd.c index 66a9e48f..556235e6 100644 --- a/osdep-freebsd.c +++ b/osdep-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: osdep-freebsd.c,v 1.6 2009-02-07 19:24:50 nicm Exp $ */ +/* $Id: osdep-freebsd.c,v 1.7 2009-02-07 19:27:11 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -87,12 +88,12 @@ retry: bestp = p; if (!is_stopped(p) && is_stopped(bestp)) bestp = p; - - if (p->ki_estcpu < bestp->ki_estcpu) - continue; - if (p->ki_slptime > bestp->ki_slptime) - continue; - bestp = p; + if (p->ki_estcpu > bestp->ki_estcpu) + bestp = p; + if (p->ki_slptime < bestp->ki_slptime) + bestp = p; + if (timercmp(&p->ki_rusage_ch, &bestp->ki_rusage_ch, <)) + bestp = p; } if (bestp != NULL) { procname = get_proc_argv0(bestp->ki_pid);