1// 2// experimental acid functions for Inferno (common to native and emu) 3// 4// problems arise because of unnamed substructures having to be 5// named in emu, for instance Ref. We cheat by ``knowing'' that Ref 6// is first in the structure, to keep this code portable between native 7// and emu. 8// 9 10// 11// ps() - Process Listing 12// 13complex Ref pidalloc; 14 15defn 16ps() 17{ 18 local i; 19 local n; 20 local done; 21 local p; 22 local curpid; 23 24 i = 0; 25 done = 0; 26 n = pidalloc.ref; 27 curpid = pid; 28 p = procalloc.arena; 29 30 if n > conf.nproc then 31 n = conf.nproc; 32 33 print("PID PC PRI STATE NAME\n"); 34 while n > 0 && i < conf.nproc do { 35 complex Proc p; 36 if p.state != 0 then { 37 print(p.pid, "\t", p.pc\X, "\t", p.pri, "\t", status(p.pid), "\t"); 38 mem(p.text, "s"); 39 n = n - 1; 40 } 41 i = i + 1; 42 p = p + sizeofProc; 43 } 44} 45 46defn labels() 47{ 48 local n; 49 local l; 50 complex Proc proc; 51 52 n = proc.nerrlab; 53 l = proc.errlab; 54 while n > 0 do { 55 complex Label l; 56 print(l.pc\a, " "); 57 pfl(l.pc); 58 l = l + sizeofLabel; 59 n = n - 1; 60 } 61} 62 63print("$ROOT/lib/acid/inferno"); 64