summaryrefslogtreecommitdiffstats
path: root/lib/libkvm
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2014-10-18 19:36:11 +0000
committeradrian <adrian@FreeBSD.org>2014-10-18 19:36:11 +0000
commit9b44fe556be01b7365289ce03c873448f9158644 (patch)
tree001cb1730d8c530fa2dede702f8a9a45fb21aef9 /lib/libkvm
parent073b7e1f4d4771f686e7f67b7d18d1b9fc02cdb8 (diff)
downloadFreeBSD-src-9b44fe556be01b7365289ce03c873448f9158644.zip
FreeBSD-src-9b44fe556be01b7365289ce03c873448f9158644.tar.gz
Update the ULE scheduler + thread and kinfo structs to use int for cpuid
rather than u_char. To try and play nice with the ABI, the u_char CPU ID values are clamped at 254. The new fields now contain the full CPU ID, or -1 for no cpu. Differential Revision: D955 Reviewed by: jhb, kib Sponsored by: Norse Corp, Inc.
Diffstat (limited to 'lib/libkvm')
-rw-r--r--lib/libkvm/kvm_proc.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c
index 31258d7..aed61a8 100644
--- a/lib/libkvm/kvm_proc.c
+++ b/lib/libkvm/kvm_proc.c
@@ -431,6 +431,24 @@ nopgrp:
strlcpy(kp->ki_tdname, mtd.td_name, sizeof(kp->ki_tdname));
kp->ki_pctcpu = 0;
kp->ki_rqindex = 0;
+
+ /*
+ * Note: legacy fields; wraps at NO_CPU_OLD or the
+ * old max CPU value as appropriate
+ */
+ if (mtd.td_lastcpu == NOCPU)
+ kp->ki_lastcpu_old = NOCPU_OLD;
+ else if (mtd.td_lastcpu > MAXCPU_OLD)
+ kp->ki_lastcpu_old = MAXCPU_OLD;
+ else
+ kp->ki_lastcpu_old = mtd.td_lastcpu;
+
+ if (mtd.td_oncpu == NOCPU)
+ kp->ki_oncpu_old = NOCPU_OLD;
+ else if (mtd.td_oncpu > MAXCPU_OLD)
+ kp->ki_oncpu_old = MAXCPU_OLD;
+ else
+ kp->ki_oncpu_old = mtd.td_oncpu;
} else {
kp->ki_stat = SZOMB;
}
OpenPOWER on IntegriCloud