summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1999-03-05 16:38:13 +0000
committerbde <bde@FreeBSD.org>1999-03-05 16:38:13 +0000
commit79ceaf95c22bc4a24d2b9c4537db262e8bb25037 (patch)
treec861eb94437a64979a963c3b3d0caf8a4ea07dbe
parent86095272bdc1a9961729279d77c8548cd0c79f16 (diff)
downloadFreeBSD-src-79ceaf95c22bc4a24d2b9c4537db262e8bb25037.zip
FreeBSD-src-79ceaf95c22bc4a24d2b9c4537db262e8bb25037.tar.gz
The magic "no-cpu" cpu number is 0xff. Don't misrepresent cpu
numbers as chars or use bogus casts in an attempt to unmisrepresnt them. In top, don't assume that 0xff is the only negative cpu number when cpu numbers are (mis)represented.
-rw-r--r--sys/amd64/amd64/mp_machdep.c6
-rw-r--r--sys/amd64/amd64/mptable.c6
-rw-r--r--sys/amd64/include/mptable.h6
-rw-r--r--sys/i386/i386/mp_machdep.c6
-rw-r--r--sys/i386/i386/mptable.c6
-rw-r--r--sys/i386/include/mptable.h6
-rw-r--r--sys/kern/kern_resource.c4
-rw-r--r--sys/kern/kern_synch.c4
-rw-r--r--sys/kern/subr_smp.c6
-rw-r--r--sys/sys/proc.h6
-rw-r--r--usr.bin/top/machine.c4
11 files changed, 30 insertions, 30 deletions
diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index 6f7c881..2267f5a 100644
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.91 1999/02/19 19:34:47 luoqi Exp $
+ * $Id: mp_machdep.c,v 1.92 1999/02/26 03:42:50 tegge Exp $
*/
#include "opt_smp.h"
@@ -2590,7 +2590,7 @@ forward_signal(struct proc *p)
while (1) {
if (p->p_stat != SRUN)
return;
- id = (u_char) p->p_oncpu;
+ id = p->p_oncpu;
if (id == 0xff)
return;
map = (1<<id);
@@ -2608,7 +2608,7 @@ forward_signal(struct proc *p)
break;
}
}
- if (id == (u_char) p->p_oncpu)
+ if (id == p->p_oncpu)
return;
}
}
diff --git a/sys/amd64/amd64/mptable.c b/sys/amd64/amd64/mptable.c
index 6f7c881..2267f5a 100644
--- a/sys/amd64/amd64/mptable.c
+++ b/sys/amd64/amd64/mptable.c
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.91 1999/02/19 19:34:47 luoqi Exp $
+ * $Id: mp_machdep.c,v 1.92 1999/02/26 03:42:50 tegge Exp $
*/
#include "opt_smp.h"
@@ -2590,7 +2590,7 @@ forward_signal(struct proc *p)
while (1) {
if (p->p_stat != SRUN)
return;
- id = (u_char) p->p_oncpu;
+ id = p->p_oncpu;
if (id == 0xff)
return;
map = (1<<id);
@@ -2608,7 +2608,7 @@ forward_signal(struct proc *p)
break;
}
}
- if (id == (u_char) p->p_oncpu)
+ if (id == p->p_oncpu)
return;
}
}
diff --git a/sys/amd64/include/mptable.h b/sys/amd64/include/mptable.h
index 6f7c881..2267f5a 100644
--- a/sys/amd64/include/mptable.h
+++ b/sys/amd64/include/mptable.h
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.91 1999/02/19 19:34:47 luoqi Exp $
+ * $Id: mp_machdep.c,v 1.92 1999/02/26 03:42:50 tegge Exp $
*/
#include "opt_smp.h"
@@ -2590,7 +2590,7 @@ forward_signal(struct proc *p)
while (1) {
if (p->p_stat != SRUN)
return;
- id = (u_char) p->p_oncpu;
+ id = p->p_oncpu;
if (id == 0xff)
return;
map = (1<<id);
@@ -2608,7 +2608,7 @@ forward_signal(struct proc *p)
break;
}
}
- if (id == (u_char) p->p_oncpu)
+ if (id == p->p_oncpu)
return;
}
}
diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c
index 6f7c881..2267f5a 100644
--- a/sys/i386/i386/mp_machdep.c
+++ b/sys/i386/i386/mp_machdep.c
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.91 1999/02/19 19:34:47 luoqi Exp $
+ * $Id: mp_machdep.c,v 1.92 1999/02/26 03:42:50 tegge Exp $
*/
#include "opt_smp.h"
@@ -2590,7 +2590,7 @@ forward_signal(struct proc *p)
while (1) {
if (p->p_stat != SRUN)
return;
- id = (u_char) p->p_oncpu;
+ id = p->p_oncpu;
if (id == 0xff)
return;
map = (1<<id);
@@ -2608,7 +2608,7 @@ forward_signal(struct proc *p)
break;
}
}
- if (id == (u_char) p->p_oncpu)
+ if (id == p->p_oncpu)
return;
}
}
diff --git a/sys/i386/i386/mptable.c b/sys/i386/i386/mptable.c
index 6f7c881..2267f5a 100644
--- a/sys/i386/i386/mptable.c
+++ b/sys/i386/i386/mptable.c
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.91 1999/02/19 19:34:47 luoqi Exp $
+ * $Id: mp_machdep.c,v 1.92 1999/02/26 03:42:50 tegge Exp $
*/
#include "opt_smp.h"
@@ -2590,7 +2590,7 @@ forward_signal(struct proc *p)
while (1) {
if (p->p_stat != SRUN)
return;
- id = (u_char) p->p_oncpu;
+ id = p->p_oncpu;
if (id == 0xff)
return;
map = (1<<id);
@@ -2608,7 +2608,7 @@ forward_signal(struct proc *p)
break;
}
}
- if (id == (u_char) p->p_oncpu)
+ if (id == p->p_oncpu)
return;
}
}
diff --git a/sys/i386/include/mptable.h b/sys/i386/include/mptable.h
index 6f7c881..2267f5a 100644
--- a/sys/i386/include/mptable.h
+++ b/sys/i386/include/mptable.h
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.91 1999/02/19 19:34:47 luoqi Exp $
+ * $Id: mp_machdep.c,v 1.92 1999/02/26 03:42:50 tegge Exp $
*/
#include "opt_smp.h"
@@ -2590,7 +2590,7 @@ forward_signal(struct proc *p)
while (1) {
if (p->p_stat != SRUN)
return;
- id = (u_char) p->p_oncpu;
+ id = p->p_oncpu;
if (id == 0xff)
return;
map = (1<<id);
@@ -2608,7 +2608,7 @@ forward_signal(struct proc *p)
break;
}
}
- if (id == (u_char) p->p_oncpu)
+ if (id == p->p_oncpu)
return;
}
}
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c
index 2fee8f8..99985f7 100644
--- a/sys/kern/kern_resource.c
+++ b/sys/kern/kern_resource.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_resource.c 8.5 (Berkeley) 1/21/94
- * $Id: kern_resource.c,v 1.41 1999/02/25 11:03:08 bde Exp $
+ * $Id: kern_resource.c,v 1.42 1999/02/28 10:53:29 bde Exp $
*/
#include "opt_compat.h"
@@ -513,7 +513,7 @@ calcru(p, up, sp, ip)
totusec = p->p_runtime;
#ifdef SMP
- if (p->p_oncpu != (char)0xff) {
+ if (p->p_oncpu != 0xff) {
#else
if (p == curproc) {
#endif
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 892f8bb..72b788c 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_synch.c 8.9 (Berkeley) 5/19/95
- * $Id: kern_synch.c,v 1.74 1999/02/28 10:53:29 bde Exp $
+ * $Id: kern_synch.c,v 1.75 1999/03/03 18:15:29 julian Exp $
*/
#include "opt_ktrace.h"
@@ -290,7 +290,7 @@ schedcpu(arg)
#define PPQ (128 / NQS) /* priorities per queue */
if ((p != curproc) &&
#ifdef SMP
- (u_char)p->p_oncpu == 0xff && /* idle */
+ p->p_oncpu == 0xff && /* idle */
#endif
p->p_stat == SRUN &&
(p->p_flag & P_INMEM) &&
diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c
index 6f7c881..2267f5a 100644
--- a/sys/kern/subr_smp.c
+++ b/sys/kern/subr_smp.c
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp_machdep.c,v 1.91 1999/02/19 19:34:47 luoqi Exp $
+ * $Id: mp_machdep.c,v 1.92 1999/02/26 03:42:50 tegge Exp $
*/
#include "opt_smp.h"
@@ -2590,7 +2590,7 @@ forward_signal(struct proc *p)
while (1) {
if (p->p_stat != SRUN)
return;
- id = (u_char) p->p_oncpu;
+ id = p->p_oncpu;
if (id == 0xff)
return;
map = (1<<id);
@@ -2608,7 +2608,7 @@ forward_signal(struct proc *p)
break;
}
}
- if (id == (u_char) p->p_oncpu)
+ if (id == p->p_oncpu)
return;
}
}
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 1d0a9b7..6f51c57 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)proc.h 8.15 (Berkeley) 5/19/95
- * $Id: proc.h,v 1.72 1999/02/28 10:53:29 bde Exp $
+ * $Id: proc.h,v 1.73 1999/03/03 18:15:29 julian Exp $
*/
#ifndef _SYS_PROC_H_
@@ -171,8 +171,8 @@ struct proc {
struct vnode *p_textvp; /* Vnode of executable. */
char p_lock; /* Process lock (prevent swap) count. */
- char p_oncpu; /* Which cpu we are on */
- char p_lastcpu; /* Last cpu we were on */
+ u_char p_oncpu; /* Which cpu we are on */
+ u_char p_lastcpu; /* Last cpu we were on */
char p_pad2; /* alignment */
short p_locks; /* DEBUG: lockmgr count of held locks */
diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c
index 6aabe8a..d64d494 100644
--- a/usr.bin/top/machine.c
+++ b/usr.bin/top/machine.c
@@ -19,7 +19,7 @@
* Steven Wallace <swallace@freebsd.org>
* Wolfram Schneider <wosch@FreeBSD.org>
*
- * $Id: machine.c,v 1.20 1999/02/06 06:33:55 dillon Exp $
+ * $Id: machine.c,v 1.21 1999/02/06 16:58:50 fenner Exp $
*/
@@ -584,7 +584,7 @@ char *(*get_userid)();
/* generate "STATE" field */
switch (state = PP(pp, p_stat)) {
case SRUN:
- if (smpmode && PP(pp, p_oncpu) >= 0)
+ if (smpmode && PP(pp, p_oncpu) == 0xff)
sprintf(status, "CPU%d", PP(pp, p_oncpu));
else
strcpy(status, "RUN");
OpenPOWER on IntegriCloud