aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>1999-03-05 16:38:13 +0000
committerBruce Evans <bde@FreeBSD.org>1999-03-05 16:38:13 +0000
commitefc96764e08d591aca3d0802b15d5676315daafb (patch)
treeae1915d174d88b6360d2cec1d1537c374cce37b4
parent4eb316f78291ed9618ad5b4be4d19a3c3798349f (diff)
downloadsrc-efc96764e08d591aca3d0802b15d5676315daafb.tar.gz
src-efc96764e08d591aca3d0802b15d5676315daafb.zip
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.
Notes
Notes: svn path=/head/; revision=44487
-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 6f7c88139d41..2267f5a6a978 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 6f7c88139d41..2267f5a6a978 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 6f7c88139d41..2267f5a6a978 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 6f7c88139d41..2267f5a6a978 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 6f7c88139d41..2267f5a6a978 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 6f7c88139d41..2267f5a6a978 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 2fee8f8ae059..99985f74592d 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 892f8bbe2edc..72b788c48bff 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 6f7c88139d41..2267f5a6a978 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 1d0a9b721231..6f51c57c4922 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 6aabe8adf41f..d64d494e128c 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");