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) {
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;
/* 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);
}
/* 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));
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 */
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 */
}
/*
/* 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 */
* 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 */
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