From: Tomas Hruby Date: Thu, 12 Nov 2009 08:35:26 +0000 (+0000) Subject: Use of isemptyp() macro instead of testing RTS_SLOT_FREE flag X-Git-Tag: v3.1.6~206 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/cppcheck-error.log?a=commitdiff_plain;h=37a7e1b76baf5a83086a812f54612a7e4a51b8e4;p=minix.git Use of isemptyp() macro instead of testing RTS_SLOT_FREE flag - some code used to test if only this flag is set, some if also this flag is set. This change unifies the test --- diff --git a/commands/ps/ps.c b/commands/ps/ps.c index fc1b5bd67..03d637a77 100644 --- a/commands/ps/ps.c +++ b/commands/ps/ps.c @@ -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; } diff --git a/commands/simple/dumpcore.c b/commands/simple/dumpcore.c index ee4272539..ac8038e9d 100644 --- a/commands/simple/dumpcore.c +++ b/commands/simple/dumpcore.c @@ -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; diff --git a/commands/simple/top.c b/commands/simple/top.c index 66b2135aa..38f83b27b 100644 --- a/commands/simple/top.c +++ b/commands/simple/top.c @@ -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) { diff --git a/kernel/arch/i386/memory.c b/kernel/arch/i386/memory.c index 6eeb659c3..c11b5c11d 100644 --- a/kernel/arch/i386/memory.c +++ b/kernel/arch/i386/memory.c @@ -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; diff --git a/kernel/arch/i386/protect.c b/kernel/arch/i386/protect.c index 30a3db5c4..29870b96c 100644 --- a/kernel/arch/i386/protect.c +++ b/kernel/arch/i386/protect.c @@ -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); diff --git a/kernel/arch/i386/system.c b/kernel/arch/i386/system.c index b0a04d01f..dc0a12e83 100644 --- a/kernel/arch/i386/system.c +++ b/kernel/arch/i386/system.c @@ -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); } diff --git a/servers/is/dmp_kernel.c b/servers/is/dmp_kernel.c index f6471d229..9f335d0f5 100644 --- a/servers/is/dmp_kernel.c +++ b/servers/is/dmp_kernel.c @@ -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",