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.
This commit is contained in:
Bruce Evans 1999-03-05 16:38:13 +00:00
parent 4eb316f782
commit efc96764e0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=44487
11 changed files with 30 additions and 30 deletions

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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

View File

@ -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) &&

View File

@ -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;
}
}

View File

@ -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 */

View File

@ -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");