All macros defining rts flags are prefixed with RTS_

- macros used with RTS_SET group of macros to define struct proc p_rts_flags are
  now prefixed with RTS_ to make things clear
This commit is contained in:
Tomas Hruby 2009-11-10 09:11:13 +00:00
parent daf7940c69
commit a972f4bacc
29 changed files with 160 additions and 158 deletions

View file

@ -404,7 +404,7 @@ char *argv[];
#else
0,
#endif
(buf.ps_flags & RECEIVING ?
(buf.ps_flags & RTS_RECEIVING ?
prrecv(&buf) :
""),
tname((Dev_t) buf.ps_dev),
@ -495,7 +495,7 @@ int endpoints;
return -1;
}
if ((ps_proc[p_ki].p_rts_flags == SLOT_FREE)
if ((ps_proc[p_ki].p_rts_flags == RTS_SLOT_FREE)
&& !(ps_mproc[p_nr].mp_flags & IN_USE)) {
return -1;
}

View file

@ -81,7 +81,7 @@ int dumpcore(endpoint_t proc_e)
for(proc_s = 0; proc_s < SLOTS; proc_s++)
if(proc[proc_s].p_endpoint == proc_e &&
!(proc[proc_s].p_rts_flags & SLOT_FREE))
!(proc[proc_s].p_rts_flags & RTS_SLOT_FREE))
break;
if(proc_s >= SLOTS) {
@ -94,7 +94,7 @@ int dumpcore(endpoint_t proc_e)
return 1;
}
if(proc[proc_s].p_rts_flags & SLOT_FREE) {
if(proc[proc_s].p_rts_flags & RTS_SLOT_FREE) {
printf( "slot %d is no process (internal error).\n",
proc_s);
return 1;

View file

@ -86,10 +86,10 @@ int print_proc_summary(struct proc *proc)
for(p = 0; p < PROCS; p++) {
if(p - NR_TASKS == IDLE)
continue;
if(proc[p].p_rts_flags & SLOT_FREE)
if(proc[p].p_rts_flags & RTS_SLOT_FREE)
continue;
alive++;
if(proc[p].p_rts_flags & ~SLOT_FREE)
if(proc[p].p_rts_flags & ~RTS_SLOT_FREE)
sleeping++;
else
running++;
@ -128,7 +128,7 @@ void print_procs(int maxlines,
if(dt < 1) return;
for(p = nprocs = 0; p < PROCS; p++) {
if(proc2[p].p_rts_flags & SLOT_FREE)
if(proc2[p].p_rts_flags & RTS_SLOT_FREE)
continue;
tick_procs[nprocs].p = proc2 + p;
if(proc1[p].p_endpoint == proc2[p].p_endpoint) {

View file

@ -35,7 +35,7 @@ struct proc *p;
p->p_seg.p_cr3 = 0;
p->p_misc_flags &= ~MF_FULLVM;
}
RTS_LOCK_UNSET(p, VMINHIBIT);
RTS_LOCK_UNSET(p, RTS_VMINHIBIT);
return OK;
case VMCTL_INCSP:
/* Increase process SP. */
@ -47,7 +47,7 @@ struct proc *p;
if(!(rp=pagefaults))
return ESRCH;
pagefaults = rp->p_nextpagefault;
if(!RTS_ISSET(rp, PAGEFAULT))
if(!RTS_ISSET(rp, RTS_PAGEFAULT))
minix_panic("non-PAGEFAULT process on pagefault chain",
rp->p_endpoint);
m_ptr->SVMCTL_PF_WHO = rp->p_endpoint;

View file

@ -84,8 +84,8 @@ void pagefault( struct proc *pr,
/* Don't schedule this process until pagefault is handled. */
vmassert(pr->p_seg.p_cr3 == read_cr3());
vmassert(!RTS_ISSET(pr, PAGEFAULT));
RTS_LOCK_SET(pr, PAGEFAULT);
vmassert(!RTS_ISSET(pr, RTS_PAGEFAULT));
RTS_LOCK_SET(pr, RTS_PAGEFAULT);
/* Save pagefault details, suspend process,
* add process to pagefault chain,

View file

@ -472,7 +472,7 @@ PUBLIC int vm_lookup(struct proc *proc, vir_bytes virtual, vir_bytes *physical,
vmassert(proc);
vmassert(physical);
vmassert(!(proc->p_rts_flags & SLOT_FREE));
vmassert(!(proc->p_rts_flags & RTS_SLOT_FREE));
if(!HASPT(proc)) {
*physical = virtual;
@ -599,10 +599,10 @@ PUBLIC int vm_suspend(struct proc *caller, struct proc *target,
/* This range is not OK for this process. Set parameters
* of the request and notify VM about the pending request.
*/
vmassert(!RTS_ISSET(caller, VMREQUEST));
vmassert(!RTS_ISSET(target, VMREQUEST));
vmassert(!RTS_ISSET(caller, RTS_VMREQUEST));
vmassert(!RTS_ISSET(target, RTS_VMREQUEST));
RTS_LOCK_SET(caller, VMREQUEST);
RTS_LOCK_SET(caller, RTS_VMREQUEST);
#if DEBUG_VMASSERT
caller->p_vmrequest.stacktrace[0] = '\0';
@ -879,11 +879,11 @@ int vmcheck; /* if nonzero, can return VMSUSPEND */
caller = proc_addr(who_p);
if(RTS_ISSET(caller, VMREQUEST)) {
if(RTS_ISSET(caller, RTS_VMREQUEST)) {
struct proc *target;
int pn;
vmassert(caller->p_vmrequest.vmresult != VMSUSPEND);
RTS_LOCK_UNSET(caller, VMREQUEST);
RTS_LOCK_UNSET(caller, RTS_VMREQUEST);
if(caller->p_vmrequest.vmresult != OK) {
printf("virtual_copy: returning VM error %d\n",
caller->p_vmrequest.vmresult);

View file

@ -315,7 +315,7 @@ for (rp = BEG_PROC_ADDR; rp < END_PROC_ADDR; ++rp) {
int privilege;
int cs, ds;
if (RTS_ISSET(rp, SLOT_FREE))
if (RTS_ISSET(rp, RTS_SLOT_FREE))
continue;
if( (iskernelp(rp)))
@ -456,7 +456,7 @@ PUBLIC int prot_set_kern_seg_limit(vir_bytes limit)
/* Increase kernel processes too. */
for (rp = BEG_PROC_ADDR; rp < END_PROC_ADDR; ++rp) {
if (RTS_ISSET(rp, SLOT_FREE) || !iskernelp(rp))
if (RTS_ISSET(rp, RTS_SLOT_FREE) || !iskernelp(rp))
continue;
rp->p_memmap[S].mem_len += incr_clicks;
alloc_segments(rp);

View file

@ -191,7 +191,7 @@ PRIVATE void ser_dump_segs(void)
struct proc *pp;
for (pp= BEG_PROC_ADDR; pp < END_PROC_ADDR; pp++)
{
if (pp->p_rts_flags & SLOT_FREE)
if (pp->p_rts_flags & RTS_SLOT_FREE)
continue;
kprintf("%d: %s ep %d\n", proc_nr(pp), pp->p_name, pp->p_endpoint);
printseg("cs: ", 1, pp, pp->p_reg.cs);
@ -260,10 +260,10 @@ PRIVATE void printslot(struct proc *pp, int level)
pp->p_sys_time, pp->p_seg.p_cr3,
rtsflagstr(pp->p_rts_flags), miscflagstr(pp->p_misc_flags));
if(pp->p_rts_flags & SENDING) {
if(pp->p_rts_flags & RTS_SENDING) {
dep = pp->p_sendto_e;
kprintf(" to: ");
} else if(pp->p_rts_flags & RECEIVING) {
} else if(pp->p_rts_flags & RTS_RECEIVING) {
dep = pp->p_getfrom_e;
kprintf(" from: ");
}
@ -277,7 +277,7 @@ PRIVATE void printslot(struct proc *pp, int level)
kprintf(" ??? %d\n", dep);
} else {
depproc = proc_addr(procno);
if(depproc->p_rts_flags & SLOT_FREE) {
if(depproc->p_rts_flags & RTS_SLOT_FREE) {
kprintf(" empty slot %d???\n", procno);
depproc = NULL;
} else {
@ -304,7 +304,7 @@ PUBLIC void ser_dump_proc()
for (pp= BEG_PROC_ADDR; pp < END_PROC_ADDR; pp++)
{
if (pp->p_rts_flags & SLOT_FREE)
if (pp->p_rts_flags & RTS_SLOT_FREE)
continue;
printslot(pp, 0);
}

View file

@ -279,7 +279,7 @@ PUBLIC int ap_timer_int_handler(void)
if (p->p_rts_flags == 0 && p->p_ticks_left <= 0 &&
priv(p)->s_flags & PREEMPTIBLE) {
/* this dequeues the process */
RTS_SET(p, NO_QUANTUM);
RTS_SET(p, RTS_NO_QUANTUM);
}
return 1;

View file

@ -62,7 +62,7 @@ check_runqueues_f(char *file, int line)
if(xp->p_magic != PMAGIC) {
MYPANIC("magic wrong in xp");
}
if (RTS_ISSET(xp, SLOT_FREE)) {
if (RTS_ISSET(xp, RTS_SLOT_FREE)) {
kprintf("scheduling error: dead proc q %d %d\n",
q, xp->p_endpoint);
MYPANIC("dead proc on run queue");
@ -116,21 +116,21 @@ rtsflagstr(int flags)
#define FLAG(n) if(flags & n) { strcat(str, #n " "); }
FLAG(SLOT_FREE);
FLAG(PROC_STOP);
FLAG(SENDING);
FLAG(RECEIVING);
FLAG(SIGNALED);
FLAG(SIG_PENDING);
FLAG(P_STOP);
FLAG(NO_PRIV);
FLAG(NO_ENDPOINT);
FLAG(VMINHIBIT);
FLAG(PAGEFAULT);
FLAG(VMREQUEST);
FLAG(VMREQTARGET);
FLAG(PREEMPTED);
FLAG(NO_QUANTUM);
FLAG(RTS_SLOT_FREE);
FLAG(RTS_PROC_STOP);
FLAG(RTS_SENDING);
FLAG(RTS_RECEIVING);
FLAG(RTS_SIGNALED);
FLAG(RTS_SIG_PENDING);
FLAG(RTS_P_STOP);
FLAG(RTS_NO_PRIV);
FLAG(RTS_NO_ENDPOINT);
FLAG(RTS_VMINHIBIT);
FLAG(RTS_PAGEFAULT);
FLAG(RTS_VMREQUEST);
FLAG(RTS_VMREQTARGET);
FLAG(RTS_PREEMPTED);
FLAG(RTS_NO_QUANTUM);
return str;
}

View file

@ -18,7 +18,7 @@
#define SENDA 16 /* asynchronous send */
#define WILLRECEIVE(target, source_ep) \
((RTS_ISSET(target, RECEIVING) && !RTS_ISSET(target, SENDING)) && \
((RTS_ISSET(target, RTS_RECEIVING) && !RTS_ISSET(target, RTS_SENDING)) && \
(target->p_getfrom_e == ANY || target->p_getfrom_e == source_ep))

View file

@ -50,7 +50,7 @@ PUBLIC void main()
* privilege structures for the system processes.
*/
for (rp = BEG_PROC_ADDR, i = -NR_TASKS; rp < END_PROC_ADDR; ++rp, ++i) {
rp->p_rts_flags = SLOT_FREE; /* initialize free slot */
rp->p_rts_flags = RTS_SLOT_FREE; /* initialize free slot */
#if DEBUG_SCHED_CHECK
rp->p_magic = PMAGIC;
#endif
@ -174,11 +174,11 @@ PUBLIC void main()
* done this; until then, don't let it run.
*/
if(priv(rp)->s_flags & PROC_FULLVM)
RTS_SET(rp, VMINHIBIT);
RTS_SET(rp, RTS_VMINHIBIT);
/* Set ready. The HARDWARE task is never ready. */
if (rp->p_nr == HARDWARE) RTS_SET(rp, PROC_STOP);
RTS_UNSET(rp, SLOT_FREE); /* remove SLOT_FREE and schedule */
if (rp->p_nr == HARDWARE) RTS_SET(rp, RTS_PROC_STOP);
RTS_UNSET(rp, RTS_SLOT_FREE); /* remove RTS_SLOT_FREE and schedule */
alloc_segments(rp);
}

View file

@ -148,13 +148,13 @@ PUBLIC struct proc * schedcheck(void)
*/
not_runnable_pick_new:
if (proc_is_preempted(proc_ptr)) {
proc_ptr->p_rts_flags &= ~PREEMPTED;
proc_ptr->p_rts_flags &= ~RTS_PREEMPTED;
if (proc_is_runnable(proc_ptr))
enqueue_head(proc_ptr);
}
/* this enqueues the process again */
if (proc_no_quantum(proc_ptr))
RTS_UNSET(proc_ptr, NO_QUANTUM);
RTS_UNSET(proc_ptr, RTS_NO_QUANTUM);
proc_ptr = pick_proc();
check_misc_flags:
@ -192,7 +192,7 @@ check_misc_flags:
* inform PM.
*/
if ((proc_ptr->p_misc_flags & MF_SIG_DELAY) &&
!RTS_ISSET(proc_ptr, SENDING))
!RTS_ISSET(proc_ptr, RTS_SENDING))
sig_delay_done(proc_ptr);
}
else if (proc_ptr->p_misc_flags & MF_SC_TRACE) {
@ -313,7 +313,7 @@ long bit_map; /* notification event set or flags */
#endif
#if DEBUG_SCHED_CHECK
if (RTS_ISSET(caller_ptr, SLOT_FREE))
if (RTS_ISSET(caller_ptr, RTS_SLOT_FREE))
{
kprintf("called by the dead?!?\n");
return EINVAL;
@ -502,10 +502,10 @@ int src_dst; /* src or dst process */
/* Check whether the last process in the chain has a dependency. If it
* has not, the cycle cannot be closed and we are done.
*/
if (RTS_ISSET(xp, RECEIVING)) { /* xp has dependency */
if (RTS_ISSET(xp, RTS_RECEIVING)) { /* xp has dependency */
if(xp->p_getfrom_e == ANY) src_dst = ANY;
else okendpt(xp->p_getfrom_e, &src_dst);
} else if (RTS_ISSET(xp, SENDING)) { /* xp has dependency */
} else if (RTS_ISSET(xp, RTS_SENDING)) { /* xp has dependency */
okendpt(xp->p_sendto_e, &src_dst);
} else {
return(0); /* not a deadlock */
@ -518,7 +518,7 @@ int src_dst; /* src or dst process */
if (src_dst == proc_nr(cp)) { /* possible deadlock */
if (group_size == 2) { /* caller and src_dst */
/* The function number is magically converted to flags. */
if ((xp->p_rts_flags ^ (function << 2)) & SENDING) {
if ((xp->p_rts_flags ^ (function << 2)) & RTS_SENDING) {
return(0); /* not a deadlock */
}
}
@ -565,20 +565,20 @@ int flags;
dst_p = _ENDPOINT_P(dst_e);
dst_ptr = proc_addr(dst_p);
if (RTS_ISSET(dst_ptr, NO_ENDPOINT))
if (RTS_ISSET(dst_ptr, RTS_NO_ENDPOINT))
{
return EDSTDIED;
}
/* Check if 'dst' is blocked waiting for this message. The destination's
* SENDING flag may be set when its SENDREC call blocked while sending.
* RTS_SENDING flag may be set when its SENDREC call blocked while sending.
*/
if (WILLRECEIVE(dst_ptr, caller_ptr->p_endpoint)) {
/* Destination is indeed waiting for this message. */
vmassert(!(dst_ptr->p_misc_flags & MF_DELIVERMSG));
if((r=QueueMess(caller_ptr->p_endpoint, linaddr, dst_ptr)) != OK)
return r;
RTS_UNSET(dst_ptr, RECEIVING);
RTS_UNSET(dst_ptr, RTS_RECEIVING);
} else {
if(flags & NON_BLOCKING) {
return(ENOTREADY);
@ -589,7 +589,7 @@ int flags;
sizeof(message), addr);
if(addr) { return EFAULT; }
RTS_SET(caller_ptr, SENDING);
RTS_SET(caller_ptr, RTS_SENDING);
caller_ptr->p_sendto_e = dst_e;
/* Process is now blocked. Put in on the destination's queue. */
@ -638,18 +638,18 @@ int flags;
else
{
okendpt(src_e, &src_p);
if (RTS_ISSET(proc_addr(src_p), NO_ENDPOINT))
if (RTS_ISSET(proc_addr(src_p), RTS_NO_ENDPOINT))
{
return ESRCDIED;
}
}
/* Check to see if a message from desired source is already available.
* The caller's SENDING flag may be set if SENDREC couldn't send. If it is
/* Check to see if a message from desired source is already available. The
* caller's RTS_SENDING flag may be set if SENDREC couldn't send. If it is
* set, the process should be blocked.
*/
if (!RTS_ISSET(caller_ptr, SENDING)) {
if (!RTS_ISSET(caller_ptr, RTS_SENDING)) {
/* Check if there are pending notifications, except for SENDREC. */
if (! (caller_ptr->p_misc_flags & MF_REPLY_PEND)) {
@ -689,7 +689,7 @@ int flags;
while (*xpp != NIL_PROC) {
if (src_e == ANY || src_p == proc_nr(*xpp)) {
#if DEBUG_SCHED_CHECK
if (RTS_ISSET(*xpp, SLOT_FREE) || RTS_ISSET(*xpp, NO_ENDPOINT))
if (RTS_ISSET(*xpp, RTS_SLOT_FREE) || RTS_ISSET(*xpp, RTS_NO_ENDPOINT))
{
kprintf("%d: receive from %d; found dead %d (%s)?\n",
caller_ptr->p_endpoint, src_e, (*xpp)->p_endpoint,
@ -704,7 +704,7 @@ int flags;
vir2phys(&(*xpp)->p_sendmsg), caller_ptr);
if ((*xpp)->p_misc_flags & MF_SIG_DELAY)
sig_delay_done(*xpp);
RTS_UNSET(*xpp, SENDING);
RTS_UNSET(*xpp, RTS_SENDING);
*xpp = (*xpp)->p_q_link; /* remove from queue */
return(OK); /* report success */
}
@ -728,7 +728,7 @@ int flags;
*/
if ( ! (flags & NON_BLOCKING)) {
caller_ptr->p_getfrom_e = src_e;
RTS_SET(caller_ptr, RECEIVING);
RTS_SET(caller_ptr, RTS_RECEIVING);
return(OK);
} else {
return(ENOTREADY);
@ -773,7 +773,7 @@ endpoint_t dst_e; /* which process to notify */
if((r=QueueMess(caller_ptr->p_endpoint, vir2phys(&m), dst_ptr)) != OK) {
minix_panic("mini_notify: local QueueMess failed", NO_NUM);
}
RTS_UNSET(dst_ptr, RECEIVING);
RTS_UNSET(dst_ptr, RTS_RECEIVING);
return(OK);
}
@ -923,8 +923,8 @@ size_t size;
dst_ptr = proc_addr(dst_p);
/* NO_ENDPOINT should be removed */
if (dst_ptr->p_rts_flags & NO_ENDPOINT)
/* RTS_NO_ENDPOINT should be removed */
if (dst_ptr->p_rts_flags & RTS_NO_ENDPOINT)
{
tabent.result= EDSTDIED;
A_INSERT(i, result);
@ -953,7 +953,7 @@ size_t size;
linaddr + (vir_bytes) &table[i].msg -
(vir_bytes) table, dst_ptr);
if(tabent.result == OK)
RTS_UNSET(dst_ptr, RECEIVING);
RTS_UNSET(dst_ptr, RTS_RECEIVING);
A_INSERT(i, result);
tabent.flags= flags | AMF_DONE;
@ -1216,7 +1216,7 @@ register struct proc *rp; /* this process is now runnable */
vmassert(proc_ptr);
if ((proc_ptr->p_priority > rp->p_priority) &&
(priv(proc_ptr)->s_flags & PREEMPTIBLE))
RTS_SET(proc_ptr, PREEMPTED); /* calls dequeue() */
RTS_SET(proc_ptr, RTS_PREEMPTED); /* calls dequeue() */
#if DEBUG_SCHED_CHECK
CHECK_RUNQUEUES;

View file

@ -105,28 +105,28 @@ struct proc {
};
/* Bits for the runtime flags. A process is runnable iff p_rts_flags == 0. */
#define SLOT_FREE 0x01 /* process slot is free */
#define PROC_STOP 0x02 /* process has been stopped */
#define SENDING 0x04 /* process blocked trying to send */
#define RECEIVING 0x08 /* process blocked trying to receive */
#define SIGNALED 0x10 /* set when new kernel signal arrives */
#define SIG_PENDING 0x20 /* unready while signal being processed */
#define P_STOP 0x40 /* set when process is being traced */
#define NO_PRIV 0x80 /* keep forked system process from running */
#define NO_ENDPOINT 0x100 /* process cannot send or receive messages */
#define VMINHIBIT 0x200 /* not scheduled until pagetable set by VM */
#define PAGEFAULT 0x400 /* process has unhandled pagefault */
#define VMREQUEST 0x800 /* originator of vm memory request */
#define VMREQTARGET 0x1000 /* target of vm memory request */
#define SYS_LOCK 0x2000 /* temporary process lock flag for systask */
#define PREEMPTED 0x4000 /* this process was preempted by a higher
#define RTS_SLOT_FREE 0x01 /* process slot is free */
#define RTS_PROC_STOP 0x02 /* process has been stopped */
#define RTS_SENDING 0x04 /* process blocked trying to send */
#define RTS_RECEIVING 0x08 /* process blocked trying to receive */
#define RTS_SIGNALED 0x10 /* set when new kernel signal arrives */
#define RTS_SIG_PENDING 0x20 /* unready while signal being processed */
#define RTS_P_STOP 0x40 /* set when process is being traced */
#define RTS_NO_PRIV 0x80 /* keep forked system process from running */
#define RTS_NO_ENDPOINT 0x100 /* process cannot send or receive messages */
#define RTS_VMINHIBIT 0x200 /* not scheduled until pagetable set by VM */
#define RTS_PAGEFAULT 0x400 /* process has unhandled pagefault */
#define RTS_VMREQUEST 0x800 /* originator of vm memory request */
#define RTS_VMREQTARGET 0x1000 /* target of vm memory request */
#define RTS_SYS_LOCK 0x2000 /* temporary process lock flag for systask */
#define RTS_PREEMPTED 0x4000 /* this process was preempted by a higher
priority process and we should pick a new one
to run. Processes with this flag should be
returned to the front of their current
priority queue if they are still runnable
before we pick a new one
*/
#define NO_QUANTUM 0x8000 /* process ran out of its quantum and we should
#define RTS_NO_QUANTUM 0x8000 /* process ran out of its quantum and we should
pick a new one. Process was dequeued and
should be enqueued at the end of some run
queue again */
@ -135,8 +135,8 @@ struct proc {
#define rts_f_is_runnable(flg) ((flg) == 0)
#define proc_is_runnable(p) (rts_f_is_runnable((p)->p_rts_flags))
#define proc_is_preempted(p) ((p)->p_rts_flags & PREEMPTED)
#define proc_no_quantum(p) ((p)->p_rts_flags & NO_QUANTUM)
#define proc_is_preempted(p) ((p)->p_rts_flags & RTS_PREEMPTED)
#define proc_no_quantum(p) ((p)->p_rts_flags & RTS_NO_QUANTUM)
/* These runtime flags can be tested and manipulated by these macros. */
@ -236,7 +236,7 @@ struct proc {
#define isokprocn(n) ((unsigned) ((n) + NR_TASKS) < NR_PROCS + NR_TASKS)
#define isemptyn(n) isemptyp(proc_addr(n))
#define isemptyp(p) ((p)->p_rts_flags == SLOT_FREE)
#define isemptyp(p) ((p)->p_rts_flags == RTS_SLOT_FREE)
#define iskernelp(p) ((p) < BEG_USER_ADDR)
#define iskerneln(n) ((n) < 0)
#define isuserp(p) isusern((p) >= BEG_USER_ADDR)

View file

@ -115,7 +115,7 @@ PUBLIC void sys_task()
* until VM tells us it's allowed. VM has been notified
* and we must wait for its reply to restart the call.
*/
vmassert(RTS_ISSET(caller_ptr, VMREQUEST));
vmassert(RTS_ISSET(caller_ptr, RTS_VMREQUEST));
vmassert(caller_ptr->p_vmrequest.type == VMSTYPE_KERNELCALL);
memcpy(&caller_ptr->p_vmrequest.saved.reqmsg, &m, sizeof(m));
} else if (result != EDONTREPLY) {
@ -124,9 +124,9 @@ PUBLIC void sys_task()
* call trap.
*/
if(restarting) {
vmassert(!RTS_ISSET(restarting, VMREQUEST));
vmassert(!RTS_ISSET(restarting, RTS_VMREQUEST));
#if 0
vmassert(!RTS_ISSET(restarting, VMREQTARGET));
vmassert(!RTS_ISSET(restarting, RTS_VMREQTARGET));
#endif
}
m.m_type = result; /* report status of call */
@ -360,8 +360,8 @@ int sig_nr; /* signal to be sent, 1 to _NSIG */
rp = proc_addr(proc_nr);
if (! sigismember(&rp->p_pending, sig_nr)) {
sigaddset(&rp->p_pending, sig_nr);
if (! (RTS_ISSET(rp, SIGNALED))) { /* other pending */
RTS_LOCK_SET(rp, SIGNALED | SIG_PENDING);
if (! (RTS_ISSET(rp, RTS_SIGNALED))) { /* other pending */
RTS_LOCK_SET(rp, RTS_SIGNALED | RTS_SIG_PENDING);
send_sig(PM_PROC_NR, SIGKSIG);
}
}
@ -473,7 +473,7 @@ register struct proc *rc; /* slot of process to clean up */
}
/* Make sure that the exiting process is no longer scheduled. */
RTS_LOCK_SET(rc, NO_ENDPOINT);
RTS_LOCK_SET(rc, RTS_NO_ENDPOINT);
if (priv(rc)->s_flags & SYS_PROC)
{
if (priv(rc)->s_asynsize) {
@ -487,7 +487,7 @@ register struct proc *rc; /* slot of process to clean up */
/* If the process happens to be queued trying to send a
* message, then it must be removed from the message queues.
*/
if (RTS_ISSET(rc, SENDING)) {
if (RTS_ISSET(rc, RTS_SENDING)) {
int target_proc;
okendpt(rc->p_sendto_e, &target_proc);
@ -503,9 +503,9 @@ register struct proc *rc; /* slot of process to clean up */
}
xpp = &(*xpp)->p_q_link; /* proceed to next queued */
}
rc->p_rts_flags &= ~SENDING;
rc->p_rts_flags &= ~RTS_SENDING;
}
rc->p_rts_flags &= ~RECEIVING;
rc->p_rts_flags &= ~RTS_RECEIVING;
/* Likewise, if another process was sending or receive a message to or from
* the exiting process, it must be alerted that process no longer is alive.
@ -519,18 +519,18 @@ register struct proc *rc; /* slot of process to clean up */
unset_sys_bit(priv(rp)->s_notify_pending, priv(rc)->s_id);
/* Check if process is receiving from exiting process. */
if (RTS_ISSET(rp, RECEIVING) && rp->p_getfrom_e == rc->p_endpoint) {
if (RTS_ISSET(rp, RTS_RECEIVING) && rp->p_getfrom_e == rc->p_endpoint) {
rp->p_reg.retreg = ESRCDIED; /* report source died */
RTS_LOCK_UNSET(rp, RECEIVING); /* no longer receiving */
RTS_LOCK_UNSET(rp, RTS_RECEIVING); /* no longer receiving */
#if DEBUG_ENABLE_IPC_WARNINGS
kprintf("endpoint %d / %s receiving from dead src ep %d / %s\n",
rp->p_endpoint, rp->p_name, rc->p_endpoint, rc->p_name);
#endif
}
if (RTS_ISSET(rp, SENDING) &&
if (RTS_ISSET(rp, RTS_SENDING) &&
rp->p_sendto_e == rc->p_endpoint) {
rp->p_reg.retreg = EDSTDIED; /* report destination died */
RTS_LOCK_UNSET(rp, SENDING);
RTS_LOCK_UNSET(rp, RTS_SENDING);
#if DEBUG_ENABLE_IPC_WARNINGS
kprintf("endpoint %d / %s send to dying dst ep %d (%s)\n",
rp->p_endpoint, rp->p_name, rc->p_endpoint, rc->p_name);
@ -552,8 +552,8 @@ PRIVATE struct proc *vmrestart_check(message *m)
if(!(restarting = vmrestart))
return NULL;
vmassert(!RTS_ISSET(restarting, SLOT_FREE));
vmassert(RTS_ISSET(restarting, VMREQUEST));
vmassert(!RTS_ISSET(restarting, RTS_SLOT_FREE));
vmassert(RTS_ISSET(restarting, RTS_VMREQUEST));
type = restarting->p_vmrequest.type;
restarting->p_vmrequest.type = VMSTYPE_SYS_NONE;

View file

@ -31,11 +31,11 @@ message *m_ptr; /* pointer to request message */
return EINVAL;
rp = proc_addr(proc_nr);
if (!RTS_ISSET(rp, SIG_PENDING)) return(EINVAL);
if (!RTS_ISSET(rp, RTS_SIG_PENDING)) return(EINVAL);
/* PM has finished one kernel signal. Perhaps process is ready now? */
if (!RTS_ISSET(rp, SIGNALED)) /* new signal arrived */
RTS_LOCK_UNSET(rp, SIG_PENDING); /* remove pending flag */
if (!RTS_ISSET(rp, RTS_SIGNALED)) /* new signal arrived */
RTS_LOCK_UNSET(rp, RTS_SIG_PENDING); /* remove pending flag */
return(OK);
}

View file

@ -45,7 +45,7 @@ register message *m_ptr; /* pointer to request message */
arch_pre_exec(rp, (u32_t) m_ptr->PR_IP_PTR, (u32_t) m_ptr->PR_STACK_PTR);
/* No reply to EXEC call */
RTS_LOCK_UNSET(rp, RECEIVING);
RTS_LOCK_UNSET(rp, RTS_RECEIVING);
return(OK);
}

View file

@ -67,7 +67,7 @@ register struct proc *rc; /* slot of process to clean up */
/* Make sure that the exiting process is no longer scheduled,
* and mark slot as FREE.
*/
RTS_LOCK_SETFLAGS(rc, SLOT_FREE);
RTS_LOCK_SETFLAGS(rc, RTS_SLOT_FREE);
/* Check the table with IRQ hooks to see if hooks should be released. */
for (i=0; i < NR_IRQ_HOOKS; i++) {

View file

@ -42,7 +42,7 @@ register message *m_ptr; /* pointer to request message */
vmassert(!(rpp->p_misc_flags & MF_DELIVERMSG));
/* needs to be receiving so we know where the message buffer is */
if(!RTS_ISSET(rpp, RECEIVING)) {
if(!RTS_ISSET(rpp, RTS_RECEIVING)) {
printf("kernel: fork not done synchronously?\n");
return EINVAL;
}
@ -91,7 +91,7 @@ register message *m_ptr; /* pointer to request message */
*/
if (priv(rpp)->s_flags & SYS_PROC) {
rpc->p_priv = priv_addr(USER_PRIV_ID);
rpc->p_rts_flags |= NO_PRIV;
rpc->p_rts_flags |= RTS_NO_PRIV;
}
/* Calculate endpoint identifier, so caller knows what it is. */
@ -104,11 +104,13 @@ register message *m_ptr; /* pointer to request message */
/* Don't schedule process in VM mode until it has a new pagetable. */
if(m_ptr->PR_FORK_FLAGS & PFF_VMINHIBIT) {
RTS_LOCK_SET(rpc, VMINHIBIT);
RTS_LOCK_SET(rpc, RTS_VMINHIBIT);
}
/* Only one in group should have SIGNALED, child doesn't inherit tracing. */
RTS_LOCK_UNSET(rpc, (SIGNALED | SIG_PENDING | P_STOP));
/*
* Only one in group should have RTS_SIGNALED, child doesn't inherit tracing.
*/
RTS_LOCK_UNSET(rpc, (RTS_SIGNALED | RTS_SIG_PENDING | RTS_P_STOP));
sigemptyset(&rpc->p_pending);
return r;

View file

@ -29,12 +29,12 @@ message *m_ptr; /* pointer to request message */
/* Find the next process with pending signals. */
for (rp = BEG_USER_ADDR; rp < END_PROC_ADDR; rp++) {
if (RTS_ISSET(rp, SIGNALED)) {
if (RTS_ISSET(rp, RTS_SIGNALED)) {
/* store signaled process' endpoint */
m_ptr->SIG_ENDPT = rp->p_endpoint;
m_ptr->SIG_MAP = rp->p_pending; /* pending signals map */
sigemptyset(&rp->p_pending); /* ball is in PM's court */
RTS_LOCK_UNSET(rp, SIGNALED); /* blocked by SIG_PENDING */
RTS_LOCK_UNSET(rp, RTS_SIGNALED); /* blocked by SIG_PENDING */
return(OK);
}
}

View file

@ -41,9 +41,9 @@ PUBLIC int do_nice(message *m_ptr)
/* Make sure the process is not running while changing its priority.
* Put the process back in its new queue if it is runnable.
*/
RTS_LOCK_SET(rp, SYS_LOCK);
RTS_LOCK_SET(rp, RTS_SYS_LOCK);
rp->p_max_priority = rp->p_priority = new_q;
RTS_LOCK_UNSET(rp, SYS_LOCK);
RTS_LOCK_UNSET(rp, RTS_SYS_LOCK);
return(OK);
}

View file

@ -37,7 +37,7 @@ message *m_ptr; /* pointer to request message */
/* Check whether caller is allowed to make this call. Privileged proceses
* can only update the privileges of processes that are inhibited from
* running by the NO_PRIV flag. This flag is set when a privileged process
* running by the RTS_NO_PRIV flag. This flag is set when a privileged process
* forks.
*/
caller_ptr = proc_addr(who_p);
@ -49,7 +49,7 @@ message *m_ptr; /* pointer to request message */
switch(m_ptr->CTL_REQUEST)
{
case SYS_PRIV_INIT:
if (! RTS_ISSET(rp, NO_PRIV)) return(EPERM);
if (! RTS_ISSET(rp, RTS_NO_PRIV)) return(EPERM);
/* Make sure this process has its own privileges structure. This may
* fail, since there are only a limited number of system processes.
@ -145,17 +145,17 @@ message *m_ptr; /* pointer to request message */
}
/* Done. Privileges have been set. Allow process to run again. */
RTS_LOCK_UNSET(rp, NO_PRIV);
RTS_LOCK_UNSET(rp, RTS_NO_PRIV);
return(OK);
case SYS_PRIV_USER:
/* Make this process an ordinary user process. */
if (!RTS_ISSET(rp, NO_PRIV)) return(EPERM);
if (!RTS_ISSET(rp, RTS_NO_PRIV)) return(EPERM);
if ((i=get_priv(rp, 0)) != OK) return(i);
RTS_LOCK_UNSET(rp, NO_PRIV);
RTS_LOCK_UNSET(rp, RTS_NO_PRIV);
return(OK);
case SYS_PRIV_ADD_IO:
if (RTS_ISSET(rp, NO_PRIV))
if (RTS_ISSET(rp, RTS_NO_PRIV))
return(EPERM);
/* Only system processes get I/O resources? */
@ -186,7 +186,7 @@ message *m_ptr; /* pointer to request message */
return OK;
case SYS_PRIV_ADD_MEM:
if (RTS_ISSET(rp, NO_PRIV))
if (RTS_ISSET(rp, RTS_NO_PRIV))
return(EPERM);
/* Only system processes get memory resources? */
@ -209,7 +209,7 @@ message *m_ptr; /* pointer to request message */
return OK;
case SYS_PRIV_ADD_IRQ:
if (RTS_ISSET(rp, NO_PRIV))
if (RTS_ISSET(rp, RTS_NO_PRIV))
return(EPERM);
/* Only system processes get IRQs? */

View file

@ -17,10 +17,10 @@
*===========================================================================*/
PUBLIC int do_runctl(message *m_ptr)
{
/* Control a process's PROC_STOP flag. Used for process management.
/* Control a process's RTS_PROC_STOP flag. Used for process management.
* If the process is queued sending a message or stopped for system call
* tracing, and the RC_DELAY request flag is given, set MF_SIG_DELAY instead
* of PROC_STOP, and send a SIGNDELAY signal later when the process is done
* of RTS_PROC_STOP, and send a SIGNDELAY signal later when the process is done
* sending (ending the delay). Used by PM for safe signal delivery.
*/
int proc_nr, action, flags, delayed;
@ -41,14 +41,14 @@ PUBLIC int do_runctl(message *m_ptr)
* should not also install signal handlers *and* expect POSIX compliance.
*/
if (action == RC_STOP && (flags & RC_DELAY)) {
RTS_LOCK_SET(rp, SYS_LOCK);
RTS_LOCK_SET(rp, RTS_SYS_LOCK);
if (RTS_ISSET(rp, SENDING) || (rp->p_misc_flags & MF_SC_DEFER))
if (RTS_ISSET(rp, RTS_SENDING) || (rp->p_misc_flags & MF_SC_DEFER))
rp->p_misc_flags |= MF_SIG_DELAY;
delayed = (rp->p_misc_flags & MF_SIG_DELAY);
RTS_LOCK_UNSET(rp, SYS_LOCK);
RTS_LOCK_UNSET(rp, RTS_SYS_LOCK);
if (delayed) return(EBUSY);
}
@ -56,10 +56,10 @@ PUBLIC int do_runctl(message *m_ptr)
/* Either set or clear the stop flag. */
switch (action) {
case RC_STOP:
RTS_LOCK_SET(rp, PROC_STOP);
RTS_LOCK_SET(rp, RTS_PROC_STOP);
break;
case RC_RESUME:
RTS_LOCK_UNSET(rp, PROC_STOP);
RTS_LOCK_UNSET(rp, RTS_PROC_STOP);
break;
default:
return(EINVAL);

View file

@ -27,7 +27,7 @@
FORWARD _PROTOTYPE(int safecopy, (endpoint_t, endpoint_t, cp_grant_id_t, int, int, size_t, vir_bytes, vir_bytes, int));
#define HASGRANTTABLE(gr) \
(!RTS_ISSET(gr, NO_PRIV) && priv(gr) && priv(gr)->s_grant_table > 0)
(!RTS_ISSET(gr, RTS_NO_PRIV) && priv(gr) && priv(gr)->s_grant_table > 0)
/*===========================================================================*
* verify_grant *

View file

@ -22,7 +22,7 @@ message *m_ptr;
rp = proc_addr(who_p);
/* Copy grant table set in priv. struct. */
if (RTS_ISSET(rp, NO_PRIV) || !(priv(rp))) {
if (RTS_ISSET(rp, RTS_NO_PRIV) || !(priv(rp))) {
r = EPERM;
} else {
_K_SET_GRANT_TABLE(rp,

View file

@ -75,7 +75,7 @@ message *m_ptr; /* pointer to request message */
rp->p_reg.sp = (reg_t) frp;
rp->p_reg.pc = (reg_t) smsg.sm_sighandler;
if(!RTS_ISSET(rp, PROC_STOP)) {
if(!RTS_ISSET(rp, RTS_PROC_STOP)) {
struct proc *caller;
caller = proc_addr(who_p);
kprintf("system: warning: sigsend a running process\n");

View file

@ -85,7 +85,7 @@ register message *m_ptr;
if (isemptyp(rp)) return(EINVAL);
switch (tr_request) {
case T_STOP: /* stop process */
RTS_LOCK_SET(rp, P_STOP);
RTS_LOCK_SET(rp, RTS_P_STOP);
rp->p_reg.psw &= ~TRACEBIT; /* clear trace bit */
rp->p_misc_flags &= ~MF_SC_TRACE; /* clear syscall trace flag */
return(OK);
@ -168,19 +168,19 @@ register message *m_ptr;
/* fall through */
case T_RESUME: /* resume execution */
RTS_LOCK_UNSET(rp, P_STOP);
RTS_LOCK_UNSET(rp, RTS_P_STOP);
m_ptr->CTL_DATA = 0;
break;
case T_STEP: /* set trace bit */
rp->p_reg.psw |= TRACEBIT;
RTS_LOCK_UNSET(rp, P_STOP);
RTS_LOCK_UNSET(rp, RTS_P_STOP);
m_ptr->CTL_DATA = 0;
break;
case T_SYSCALL: /* trace system call */
rp->p_misc_flags |= MF_SC_TRACE;
RTS_LOCK_UNSET(rp, P_STOP);
RTS_LOCK_UNSET(rp, RTS_P_STOP);
m_ptr->CTL_DATA = 0;
break;

View file

@ -34,13 +34,13 @@ register message *m_ptr; /* pointer to request message */
switch(m_ptr->SVMCTL_PARAM) {
case VMCTL_CLEAR_PAGEFAULT:
RTS_LOCK_UNSET(p, PAGEFAULT);
RTS_LOCK_UNSET(p, RTS_PAGEFAULT);
return OK;
case VMCTL_MEMREQ_GET:
/* Send VM the information about the memory request. */
if(!(rp = vmrequest))
return ESRCH;
vmassert(RTS_ISSET(rp, VMREQUEST));
vmassert(RTS_ISSET(rp, RTS_VMREQUEST));
#if 0
printf("kernel: vm request sent by: %s / %d about %d; 0x%lx-0x%lx, wr %d, stack: %s ",
@ -55,9 +55,9 @@ register message *m_ptr; /* pointer to request message */
okendpt(rp->p_vmrequest.who, &proc_nr);
target = proc_addr(proc_nr);
#if 0
if(!RTS_ISSET(target, VMREQTARGET)) {
if(!RTS_ISSET(target, RTS_VMREQTARGET)) {
printf("set stack: %s\n", rp->p_vmrequest.stacktrace);
minix_panic("VMREQTARGET not set for target",
minix_panic("RTS_VMREQTARGET not set for target",
NO_NUM);
}
#endif
@ -76,7 +76,7 @@ register message *m_ptr; /* pointer to request message */
return OK;
case VMCTL_MEMREQ_REPLY:
vmassert(RTS_ISSET(p, VMREQUEST));
vmassert(RTS_ISSET(p, RTS_VMREQUEST));
vmassert(p->p_vmrequest.vmresult == VMSUSPEND);
okendpt(p->p_vmrequest.who, &proc_nr);
target = proc_addr(proc_nr);
@ -95,8 +95,8 @@ register message *m_ptr; /* pointer to request message */
p->p_vmrequest.writeflag, p->p_vmrequest.stacktrace);
printf("type %d\n", p->p_vmrequest.type);
vmassert(RTS_ISSET(target, VMREQTARGET));
RTS_LOCK_UNSET(target, VMREQTARGET);
vmassert(RTS_ISSET(target, RTS_VMREQTARGET));
RTS_LOCK_UNSET(target, RTS_VMREQTARGET);
#endif
if(p->p_vmrequest.type == VMSTYPE_KERNELCALL) {
@ -106,8 +106,8 @@ register message *m_ptr; /* pointer to request message */
} else if(p->p_vmrequest.type == VMSTYPE_DELIVERMSG) {
vmassert(p->p_misc_flags & MF_DELIVERMSG);
vmassert(p == target);
vmassert(RTS_ISSET(p, VMREQUEST));
RTS_LOCK_UNSET(p, VMREQUEST);
vmassert(RTS_ISSET(p, RTS_VMREQUEST));
RTS_LOCK_UNSET(p, RTS_VMREQUEST);
} else {
#if DEBUG_VMASSERT
printf("suspended with stack: %s\n",

View file

@ -18,9 +18,9 @@
#define PRINTRTS(rp) { \
char *procname = ""; \
printf(" %s", p_rts_flags_str(rp->p_rts_flags)); \
if (rp->p_rts_flags & SENDING) \
if (rp->p_rts_flags & RTS_SENDING) \
procname = proc_name(_ENDPOINT_P(rp->p_sendto_e)); \
else if (rp->p_rts_flags & RECEIVING) \
else if (rp->p_rts_flags & RTS_RECEIVING) \
procname = proc_name(_ENDPOINT_P(rp->p_getfrom_e)); \
printf(" %-7.7s", procname); \
}
@ -319,7 +319,7 @@ PUBLIC void privileges_dmp()
r = -1;
for (sp = &priv[0]; sp < &priv[NR_SYS_PROCS]; sp++)
if (sp->s_proc_nr == rp->p_nr) { r ++; break; }
if (r == -1 && ! (rp->p_rts_flags & SLOT_FREE)) {
if (r == -1 && ! (rp->p_rts_flags & RTS_SLOT_FREE)) {
sp = &priv[USER_PRIV_ID];
}
printf("(%02u) %-7.7s %s %s %7d",
@ -342,13 +342,13 @@ PUBLIC void privileges_dmp()
PRIVATE char *p_rts_flags_str(int flags)
{
static char str[10];
str[0] = (flags & PROC_STOP) ? 's' : '-';
str[1] = (flags & SENDING) ? 'S' : '-';
str[2] = (flags & RECEIVING) ? 'R' : '-';
str[3] = (flags & SIGNALED) ? 'I' : '-';
str[4] = (flags & SIG_PENDING) ? 'P' : '-';
str[5] = (flags & P_STOP) ? 'T' : '-';
str[6] = (flags & NO_PRIV) ? 'p' : '-';
str[0] = (flags & RTS_PROC_STOP) ? 's' : '-';
str[1] = (flags & RTS_SENDING) ? 'S' : '-';
str[2] = (flags & RTS_RECEIVING) ? 'R' : '-';
str[3] = (flags & RTS_SIGNALED) ? 'I' : '-';
str[4] = (flags & RTS_SIG_PENDING) ? 'P' : '-';
str[5] = (flags & RTS_P_STOP) ? 'T' : '-';
str[6] = (flags & RTS_NO_PRIV) ? 'p' : '-';
str[7] = '\0';
return str;