Make similar changes to the OS-dependent code for FreeBSD, and NetBSD in

accordance to OpenBSD patchset 182.
This commit is contained in:
Tiago Cunha 2009-07-28 22:28:11 +00:00
parent 6043d9cf89
commit 2dda197980
2 changed files with 29 additions and 20 deletions

View File

@ -1,4 +1,4 @@
/* $Id: osdep-freebsd.c,v 1.16 2009-06-26 15:31:15 nicm Exp $ */ /* $Id: osdep-freebsd.c,v 1.17 2009-07-28 22:28:11 tcunha Exp $ */
/* /*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@ -85,29 +85,34 @@ retry:
continue; continue;
} }
if (is_runnable(p) && !is_runnable(bestp)) if (is_runnable(p) && !is_runnable(bestp)) {
bestp = p; bestp = p;
else if (!is_runnable(p) && is_runnable(bestp)) continue;
} else if (!is_runnable(p) && is_runnable(bestp))
continue; continue;
if (!is_stopped(p) && is_stopped(bestp)) if (!is_stopped(p) && is_stopped(bestp)) {
bestp = p; bestp = p;
else if (is_stopped(p) && !is_stopped(bestp)) continue;
} else if (is_stopped(p) && !is_stopped(bestp))
continue; continue;
if (p->ki_estcpu > bestp->ki_estcpu) if (p->ki_estcpu > bestp->ki_estcpu) {
bestp = p; bestp = p;
else if (p->ki_estcpu < bestp->ki_estcpu) continue;
} else if (p->ki_estcpu < bestp->ki_estcpu)
continue; continue;
if (p->ki_slptime < bestp->ki_slptime) if (p->ki_slptime < bestp->ki_slptime) {
bestp = p; bestp = p;
else if (p->ki_slptime > bestp->ki_slptime) continue;
} else if (p->ki_slptime > bestp->ki_slptime)
continue; continue;
if (strcmp(p->ki_comm, p->ki_comm) < 0) if (strcmp(p->ki_comm, bestp->ki_comm) < 0) {
bestp = p; bestp = p;
else if (strcmp(p->ki_comm, p->ki_comm) > 0) continue;
} else if (strcmp(p->ki_comm, bestp->ki_comm) > 0)
continue; continue;
if (p->ki_pid > bestp->ki_pid) if (p->ki_pid > bestp->ki_pid)

View File

@ -1,4 +1,4 @@
/* $Id: osdep-netbsd.c,v 1.5 2009-07-15 17:53:15 nicm Exp $ */ /* $Id: osdep-netbsd.c,v 1.6 2009-07-28 22:28:11 tcunha Exp $ */
/* /*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@ -83,24 +83,28 @@ retry:
continue; continue;
} }
if (is_runnable(p) && !is_runnable(bestp)) if (is_runnable(p) && !is_runnable(bestp)) {
bestp = p; bestp = p;
else if (!is_runnable(p) && is_runnable(bestp)) continue;
} else if (!is_runnable(p) && is_runnable(bestp))
continue; continue;
if (!is_stopped(p) && is_stopped(bestp)) if (!is_stopped(p) && is_stopped(bestp)) {
bestp = p; bestp = p;
else if (is_stopped(p) && !is_stopped(bestp)) continue;
} else if (is_stopped(p) && !is_stopped(bestp))
continue; continue;
if (p->p_estcpu > bestp->p_estcpu) if (p->p_estcpu > bestp->p_estcpu) {
bestp = p; bestp = p;
else if (p->p_estcpu < bestp->p_estcpu) continue;
} else if (p->p_estcpu < bestp->p_estcpu)
continue; continue;
if (p->p_slptime < bestp->p_slptime) if (p->p_slptime < bestp->p_slptime) {
bestp = p; bestp = p;
else if (p->p_slptime > bestp->p_slptime) continue;
} else if (p->p_slptime > bestp->p_slptime)
continue; continue;
if (p->p_pid > bestp->p_pid) if (p->p_pid > bestp->p_pid)