Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/common/lib/libutil proc_compare(): weed out zombies before d...
details: https://anonhg.NetBSD.org/src/rev/3338e20b09c9
branches: trunk
changeset: 847833:3338e20b09c9
user: ad <ad%NetBSD.org@localhost>
date: Mon Jan 06 11:16:35 2020 +0000
description:
proc_compare(): weed out zombies before doing anything else. From skrll@.
diffstat:
common/lib/libutil/proc_compare.c | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
diffs (63 lines):
diff -r 9de4ab5a4483 -r 3338e20b09c9 common/lib/libutil/proc_compare.c
--- a/common/lib/libutil/proc_compare.c Mon Jan 06 11:12:55 2020 +0000
+++ b/common/lib/libutil/proc_compare.c Mon Jan 06 11:16:35 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: proc_compare.c,v 1.1 2011/10/21 02:09:00 christos Exp $ */
+/* $NetBSD: proc_compare.c,v 1.2 2020/01/06 11:16:35 ad Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
# include <sys/cdefs.h>
# if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: proc_compare.c,v 1.1 2011/10/21 02:09:00 christos Exp $");
+__RCSID("$NetBSD: proc_compare.c,v 1.2 2020/01/06 11:16:35 ad Exp $");
# endif
# include <sys/types.h>
@@ -52,7 +52,7 @@
# define P_RTIME_USEC p_rtime_usec
# else
# include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: proc_compare.c,v 1.1 2011/10/21 02:09:00 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: proc_compare.c,v 1.2 2020/01/06 11:16:35 ad Exp $");
# include <sys/param.h>
# include <sys/inttypes.h>
# include <sys/systm.h>
@@ -89,6 +89,17 @@
proc_compare(const PROC *p1, const LWP *l1, const PROC *p2, const LWP *l2)
{
/*
+ * weed out zombies
+ */
+ switch (TESTAB(P_ZOMBIE(p1), P_ZOMBIE(p2))) {
+ case ONLYA:
+ return 1;
+ case ONLYB:
+ return 0;
+ case BOTH:
+ goto out;
+ }
+ /*
* see if at least one of them is runnable
*/
switch (TESTAB(ISRUN(p1), ISRUN(p2))) {
@@ -105,17 +116,6 @@
goto out;
}
/*
- * weed out zombies
- */
- switch (TESTAB(P_ZOMBIE(p1), P_ZOMBIE(p2))) {
- case ONLYA:
- return 1;
- case ONLYB:
- return 0;
- case BOTH:
- goto out;
- }
- /*
* pick the one with the smallest sleep time
*/
if (l1->l_slptime < l2->l_slptime)
Home |
Main Index |
Thread Index |
Old Index