Removed NIL_SYS_PROC and NIL_PROC
- NIL_PROC replaced by simple NULLs
This commit is contained in:
parent
98493805fd
commit
a3ffc0f7ad
|
@ -162,7 +162,7 @@ PRIVATE void load_update(void)
|
|||
|
||||
/* Cumulation. How many processes are ready now? */
|
||||
for(q = 0; q < NR_SCHED_QUEUES; q++)
|
||||
for(p = rdy_head[q]; p != NIL_PROC; p = p->p_nextready)
|
||||
for(p = rdy_head[q]; p; p = p->p_nextready)
|
||||
enqueued++;
|
||||
|
||||
kloadinfo.proc_load_history[slot] += enqueued;
|
||||
|
|
|
@ -33,11 +33,11 @@ runqueues_ok(void)
|
|||
printf("tail but no head in %d\n", q);
|
||||
return 0;
|
||||
}
|
||||
if (rdy_tail[q] && rdy_tail[q]->p_nextready != NIL_PROC) {
|
||||
if (rdy_tail[q] && rdy_tail[q]->p_nextready) {
|
||||
printf("tail and tail->next not null in %d\n", q);
|
||||
return 0;
|
||||
}
|
||||
for(xp = rdy_head[q]; xp != NIL_PROC; xp = xp->p_nextready) {
|
||||
for(xp = rdy_head[q]; xp; xp = xp->p_nextready) {
|
||||
const vir_bytes vxp = (vir_bytes) xp;
|
||||
vir_bytes dxp;
|
||||
if(vxp < (vir_bytes) BEG_PROC_ADDR || vxp >= (vir_bytes) END_PROC_ADDR) {
|
||||
|
@ -74,7 +74,7 @@ runqueues_ok(void)
|
|||
return 0;
|
||||
}
|
||||
xp->p_found = 1;
|
||||
if (xp->p_nextready == NIL_PROC && rdy_tail[q] != xp) {
|
||||
if (!xp->p_nextready && rdy_tail[q] != xp) {
|
||||
printf("sched err: last element not tail q %d proc %d\n",
|
||||
q, xp->p_nr);
|
||||
return 0;
|
||||
|
|
|
@ -595,9 +595,9 @@ const int flags;
|
|||
|
||||
/* Process is now blocked. Put in on the destination's queue. */
|
||||
xpp = &dst_ptr->p_caller_q; /* find end of list */
|
||||
while (*xpp != NIL_PROC) xpp = &(*xpp)->p_q_link;
|
||||
while (*xpp) xpp = &(*xpp)->p_q_link;
|
||||
*xpp = caller_ptr; /* add caller to end */
|
||||
caller_ptr->p_q_link = NIL_PROC; /* mark new end of list */
|
||||
caller_ptr->p_q_link = NULL; /* mark new end of list */
|
||||
}
|
||||
return(OK);
|
||||
}
|
||||
|
@ -700,7 +700,7 @@ const int flags;
|
|||
|
||||
/* Check caller queue. Use pointer pointers to keep code simple. */
|
||||
xpp = &caller_ptr->p_caller_q;
|
||||
while (*xpp != NIL_PROC) {
|
||||
while (*xpp) {
|
||||
if (src_e == ANY || src_p == proc_nr(*xpp)) {
|
||||
int call;
|
||||
assert(!RTS_ISSET(*xpp, RTS_SLOT_FREE));
|
||||
|
@ -1156,9 +1156,9 @@ PUBLIC void enqueue(
|
|||
assert(q >= 0);
|
||||
|
||||
/* Now add the process to the queue. */
|
||||
if (rdy_head[q] == NIL_PROC) { /* add to empty queue */
|
||||
if (!rdy_head[q]) { /* add to empty queue */
|
||||
rdy_head[q] = rdy_tail[q] = rp; /* create a new queue */
|
||||
rp->p_nextready = NIL_PROC; /* mark new end */
|
||||
rp->p_nextready = NULL; /* mark new end */
|
||||
}
|
||||
else if (front) { /* add to head of queue */
|
||||
rp->p_nextready = rdy_head[q]; /* chain head of queue */
|
||||
|
@ -1167,7 +1167,7 @@ PUBLIC void enqueue(
|
|||
else { /* add to tail of queue */
|
||||
rdy_tail[q]->p_nextready = rp; /* chain tail of queue */
|
||||
rdy_tail[q] = rp; /* set new queue tail */
|
||||
rp->p_nextready = NIL_PROC; /* mark new end */
|
||||
rp->p_nextready = NULL; /* mark new end */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1215,9 +1215,9 @@ PRIVATE void enqueue_head(struct proc *rp)
|
|||
|
||||
|
||||
/* Now add the process to the queue. */
|
||||
if (rdy_head[q] == NIL_PROC) { /* add to empty queue */
|
||||
if (!rdy_head[q]) { /* add to empty queue */
|
||||
rdy_head[q] = rdy_tail[q] = rp; /* create a new queue */
|
||||
rp->p_nextready = NIL_PROC; /* mark new end */
|
||||
rp->p_nextready = NULL; /* mark new end */
|
||||
}
|
||||
else /* add to head of queue */
|
||||
rp->p_nextready = rdy_head[q]; /* chain head of queue */
|
||||
|
@ -1254,8 +1254,8 @@ PUBLIC void dequeue(const struct proc *rp)
|
|||
* process if it is found. A process can be made unready even if it is not
|
||||
* running by being sent a signal that kills it.
|
||||
*/
|
||||
prev_xp = NIL_PROC;
|
||||
for (xpp = &rdy_head[q]; *xpp != NIL_PROC; xpp = &(*xpp)->p_nextready) {
|
||||
prev_xp = NULL;
|
||||
for (xpp = &rdy_head[q]; *xpp; xpp = &(*xpp)->p_nextready) {
|
||||
if (*xpp == rp) { /* found process to remove */
|
||||
*xpp = (*xpp)->p_nextready; /* replace with next chain */
|
||||
if (rp == rdy_tail[q]) { /* queue tail removed */
|
||||
|
|
|
@ -240,8 +240,6 @@ struct proc {
|
|||
#define BEG_USER_ADDR (&proc[NR_TASKS])
|
||||
#define END_PROC_ADDR (&proc[NR_TASKS + NR_PROCS])
|
||||
|
||||
#define NIL_PROC ((struct proc *) 0)
|
||||
#define NIL_SYS_PROC ((struct proc *) 1)
|
||||
#define cproc_addr(n) (&(proc + NR_TASKS)[(n)])
|
||||
#define proc_addr(n) (&(proc[NR_TASKS + (n)]))
|
||||
#define proc_nr(p) ((p)->p_nr)
|
||||
|
|
|
@ -512,7 +512,7 @@ register struct proc *rc; /* slot of process to clean up */
|
|||
|
||||
okendpt(rc->p_sendto_e, &target_proc);
|
||||
xpp = &proc_addr(target_proc)->p_caller_q; /* destination's queue */
|
||||
while (*xpp != NIL_PROC) { /* check entire queue */
|
||||
while (*xpp) { /* check entire queue */
|
||||
if (*xpp == rc) { /* process is on the queue */
|
||||
*xpp = (*xpp)->p_q_link; /* replace by next process */
|
||||
#if DEBUG_ENABLE_IPC_WARNINGS
|
||||
|
|
Loading…
Reference in a new issue