Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F137590610
D955.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D955.diff
View Options
Index: lib/libkvm/kvm_proc.c
===================================================================
--- lib/libkvm/kvm_proc.c
+++ lib/libkvm/kvm_proc.c
@@ -431,6 +431,24 @@
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 > 254)
+ kp->ki_lastcpu_old = 254;
+ else
+ kp->ki_lastcpu_old = mtd.td_lastcpu;
+
+ if (mtd.td_oncpu == NOCPU)
+ kp->ki_oncpu_old = NOCPU_OLD;
+ else if (mtd.td_oncpu > 254)
+ kp->ki_oncpu_old = 254;
+ else
+ kp->ki_oncpu_old = mtd.td_oncpu;
} else {
kp->ki_stat = SZOMB;
}
Index: sys/compat/freebsd32/freebsd32.h
===================================================================
--- sys/compat/freebsd32/freebsd32.h
+++ sys/compat/freebsd32/freebsd32.h
@@ -332,8 +332,8 @@
signed char ki_nice;
char ki_lock;
char ki_rqindex;
- u_char ki_oncpu;
- u_char ki_lastcpu;
+ u_char ki_oncpu_old;
+ u_char ki_lastcpu_old;
char ki_tdname[TDNAMLEN+1];
char ki_wmesg[WMESGLEN+1];
char ki_login[LOGNAMELEN+1];
@@ -343,6 +343,8 @@
char ki_loginclass[LOGINCLASSLEN+1];
char ki_sparestrings[50];
int ki_spareints[KI_NSPARE_INT];
+ int ki_oncpu;
+ int ki_lastcpu;
int ki_tracer;
int ki_flag2;
int ki_fibnum;
Index: sys/kern/kern_proc.c
===================================================================
--- sys/kern/kern_proc.c
+++ sys/kern/kern_proc.c
@@ -984,6 +984,25 @@
kp->ki_wchan = td->td_wchan;
kp->ki_pri.pri_level = td->td_priority;
kp->ki_pri.pri_native = td->td_base_pri;
+
+ /*
+ * Note: legacy fields; clamp at the old NOCPU value and/or
+ * the maximum u_char CPU value.
+ */
+ if (td->td_lastcpu == NOCPU)
+ kp->ki_lastcpu_old = NOCPU_OLD;
+ else if (td->td_lastcpu > 254)
+ kp->ki_lastcpu_old = 254;
+ else
+ kp->ki_lastcpu_old = td->td_lastcpu;
+
+ if (td->td_oncpu == NOCPU)
+ kp->ki_oncpu_old = NOCPU_OLD;
+ else if (td->td_oncpu > 254)
+ kp->ki_oncpu_old = 254;
+ else
+ kp->ki_oncpu_old = td->td_oncpu;
+
kp->ki_lastcpu = td->td_lastcpu;
kp->ki_oncpu = td->td_oncpu;
kp->ki_tdflags = td->td_flags;
@@ -1164,6 +1183,11 @@
CP(*ki, *ki32, ki_rqindex);
CP(*ki, *ki32, ki_oncpu);
CP(*ki, *ki32, ki_lastcpu);
+
+ /* XXX TODO: wrap cpu value as appropriate */
+ CP(*ki, *ki32, ki_oncpu_old);
+ CP(*ki, *ki32, ki_lastcpu_old);
+
bcopy(ki->ki_tdname, ki32->ki_tdname, TDNAMLEN + 1);
bcopy(ki->ki_wmesg, ki32->ki_wmesg, WMESGLEN + 1);
bcopy(ki->ki_login, ki32->ki_login, LOGNAMELEN + 1);
Index: sys/kern/sched_ule.c
===================================================================
--- sys/kern/sched_ule.c
+++ sys/kern/sched_ule.c
@@ -90,7 +90,7 @@
struct td_sched {
struct runq *ts_runq; /* Run-queue we're queued on. */
short ts_flags; /* TSF_* flags. */
- u_char ts_cpu; /* CPU that we have affinity for. */
+ int ts_cpu; /* CPU that we have affinity for. */
int ts_rltick; /* Real last tick, for affinity. */
int ts_slice; /* Ticks of slice remaining. */
u_int ts_slptime; /* Number of ticks we vol. slept */
Index: sys/sys/proc.h
===================================================================
--- sys/sys/proc.h
+++ sys/sys/proc.h
@@ -229,8 +229,8 @@
int td_sqqueue; /* (t) Sleepqueue queue blocked on. */
void *td_wchan; /* (t) Sleep address. */
const char *td_wmesg; /* (t) Reason for sleep. */
- u_char td_lastcpu; /* (t) Last cpu we were on. */
- u_char td_oncpu; /* (t) Which cpu we are on. */
+ int td_lastcpu; /* (t) Last cpu we were on. */
+ int td_oncpu; /* (t) Which cpu we are on. */
volatile u_char td_owepreempt; /* (k*) Preempt on last critical_exit */
u_char td_tsqueue; /* (t) Turnstile queue blocked on. */
short td_locks; /* (k) Count of non-spin locks. */
@@ -601,7 +601,8 @@
#define p_session p_pgrp->pg_session
#define p_pgid p_pgrp->pg_id
-#define NOCPU 0xff /* For when we aren't on a CPU. */
+#define NOCPU (-1) /* For when we aren't on a CPU. */
+#define NOCPU_OLD (0xff)
#define PROC_SLOCK(p) mtx_lock_spin(&(p)->p_slock)
#define PROC_SUNLOCK(p) mtx_unlock_spin(&(p)->p_slock)
Index: sys/sys/user.h
===================================================================
--- sys/sys/user.h
+++ sys/sys/user.h
@@ -84,7 +84,7 @@
* it in two places: function fill_kinfo_proc in sys/kern/kern_proc.c and
* function kvm_proclist in lib/libkvm/kvm_proc.c .
*/
-#define KI_NSPARE_INT 6
+#define KI_NSPARE_INT 4
#define KI_NSPARE_LONG 12
#define KI_NSPARE_PTR 6
@@ -171,8 +171,8 @@
signed char ki_nice; /* Process "nice" value */
char ki_lock; /* Process lock (prevent swap) count */
char ki_rqindex; /* Run queue index */
- u_char ki_oncpu; /* Which cpu we are on */
- u_char ki_lastcpu; /* Last cpu we were on */
+ u_char ki_oncpu_old; /* Which cpu we are on (legacy) */
+ u_char ki_lastcpu_old; /* Last cpu we were on (legacy) */
char ki_tdname[TDNAMLEN+1]; /* thread name */
char ki_wmesg[WMESGLEN+1]; /* wchan message */
char ki_login[LOGNAMELEN+1]; /* setlogin name */
@@ -187,6 +187,8 @@
*/
char ki_sparestrings[50]; /* spare string space */
int ki_spareints[KI_NSPARE_INT]; /* spare room for growth */
+ int ki_oncpu; /* Which cpu we are on */
+ int ki_lastcpu; /* Last cpu we were on */
int ki_tracer; /* Pid of tracing process */
int ki_flag2; /* P2_* flags */
int ki_fibnum; /* Default FIB number */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 25, 11:52 AM (16 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26132240
Default Alt Text
D955.diff (5 KB)
Attached To
Mode
D955: Extend the CPU ID types in ULE, struct thread and struct kproc_user to be an int instead of a char.
Attached
Detach File
Event Timeline
Log In to Comment