]> Zhao Yanbai Git Server - minix.git/commitdiff
Use of isemptyp() macro instead of testing RTS_SLOT_FREE flag
authorTomas Hruby <tom@minix3.org>
Thu, 12 Nov 2009 08:35:26 +0000 (08:35 +0000)
committerTomas Hruby <tom@minix3.org>
Thu, 12 Nov 2009 08:35:26 +0000 (08:35 +0000)
- some code used to test if only this flag is set, some if also this flag is
  set. This change unifies the test

commands/ps/ps.c
commands/simple/dumpcore.c
commands/simple/top.c
kernel/arch/i386/memory.c
kernel/arch/i386/protect.c
kernel/arch/i386/system.c
servers/is/dmp_kernel.c

index fc1b5bd67ffa5da1a5a56d5a8913c9fb5e1a0022..03d637a77bfd8dfaab1319df3d6a7955a4b88a67 100644 (file)
@@ -495,7 +495,7 @@ int endpoints;
        return -1;
   }
 
-  if ((ps_proc[p_ki].p_rts_flags == RTS_SLOT_FREE)
+  if (isemptyp(&ps_proc[p_ki])
                                && !(ps_mproc[p_nr].mp_flags & IN_USE)) {
        return -1;
   }
index ee4272539dfded8a3d93652470bf0d698b39c9dc..ac8038e9dde7d5fc232db69597fd0140acba9841 100644 (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 & RTS_SLOT_FREE))
+                       !isemptyp(&proc[proc_s]))
                        break;
 
        if(proc_s >= SLOTS) {
@@ -94,7 +94,7 @@ int dumpcore(endpoint_t proc_e)
                return 1;
        }
 
-       if(proc[proc_s].p_rts_flags & RTS_SLOT_FREE) {
+       if(isemptyp(&proc[proc_s])) {
                printf( "slot %d is no process (internal error).\n",
                        proc_s);
                return 1;
index 66b2135aae8ab1912eba10bb1c5dcf91a82c7e8d..38f83b27b818fcbbb7d9587cbb3bc4a8711149d3 100644 (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 & RTS_SLOT_FREE)
+               if(isemptyp(&proc[p]))
                        continue;
                alive++;
-               if(proc[p].p_rts_flags & ~RTS_SLOT_FREE)
+               if(!proc_is_runnable(&proc[p]))
                        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 & RTS_SLOT_FREE)
+               if(isemptyp(&proc2[p]))
                        continue;
                tick_procs[nprocs].p = proc2 + p;
                if(proc1[p].p_endpoint == proc2[p].p_endpoint) {
index 6eeb659c3693d230ce8a50ee27f922281711f082..c11b5c11d54abadbf7c51e3af4b0e9728f6d260d 100644 (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 & RTS_SLOT_FREE));
+       vmassert(!isemptyp(proc));
 
        if(!HASPT(proc)) {
                *physical = virtual;
index 30a3db5c49f557b05bc0db531bc92a3ebfcaaba4..29870b96c5d99a744313d273d8b46f39b60f48ee 100644 (file)
@@ -315,7 +315,7 @@ for (rp = BEG_PROC_ADDR; rp < END_PROC_ADDR; ++rp) {
   int privilege;
   int cs, ds;
 
-               if (RTS_ISSET(rp, RTS_SLOT_FREE))
+               if (isemptyp(rp))
                        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, RTS_SLOT_FREE) || !iskernelp(rp))
+               if (isemptyp(rp) || !iskernelp(rp))
                        continue;
                rp->p_memmap[S].mem_len += incr_clicks;
                alloc_segments(rp);
index b0a04d01ff2b365490e132840da083d5d2b1683c..dc0a12e83e1dcc5349249f90ef42e3c9b8c1ef08 100644 (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 & RTS_SLOT_FREE)
+               if (isemptyp(pp))
                        continue;
                kprintf("%d: %s ep %d\n", proc_nr(pp), pp->p_name, pp->p_endpoint);
                printseg("cs: ", 1, pp, pp->p_reg.cs);
@@ -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 & RTS_SLOT_FREE) {
+                               if(isemptyp(depproc)) {
                                        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 & RTS_SLOT_FREE)
+               if (isemptyp(pp))
                        continue;
                printslot(pp, 0);
        }
index f6471d2297af5e3113c1627740be21405eca4e1d..9f335d0f5ce06abf68f2f0b0b01a30adf9218dce 100644 (file)
@@ -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 & RTS_SLOT_FREE)) {
+        if (r == -1 && !isemptyp(rp)) {
            sp = &priv[USER_PRIV_ID];
         }
        printf("(%02u) %-7.7s %s   %s %7d",