add swifi to the build/install.
[minix.git] / servers / is / dmp_pm.c
blobb566f559563825b72b19dcae2f341509ad1fdb64
1 /* This file contains procedures to dump to PM' data structures.
3 * The entry points into this file are
4 * mproc_dmp: display PM process table
6 * Created:
7 * May 11, 2005: by Jorrit N. Herder
8 */
10 #include "inc.h"
11 #include "../pm/mproc.h"
12 #include <timers.h>
13 #include <minix/config.h>
14 #include <minix/type.h>
16 PUBLIC struct mproc mproc[NR_PROCS];
18 /*===========================================================================*
19 * mproc_dmp *
20 *===========================================================================*/
21 PRIVATE char *flags_str(int flags)
23 static char str[14];
24 str[0] = (flags & WAITING) ? 'W' : '-';
25 str[1] = (flags & ZOMBIE) ? 'Z' : '-';
26 str[2] = (flags & PAUSED) ? 'P' : '-';
27 str[3] = (flags & ALARM_ON) ? 'A' : '-';
28 str[4] = (flags & EXITING) ? 'E' : '-';
29 str[5] = (flags & STOPPED) ? 'S' : '-';
30 str[6] = (flags & SIGSUSPENDED) ? 'U' : '-';
31 str[7] = (flags & REPLY) ? 'R' : '-';
32 str[8] = (flags & FS_CALL) ? 'F' : '-';
33 str[9] = (flags & PM_SIG_PENDING) ? 's' : '-';
34 str[10] = (flags & PRIV_PROC) ? 'p' : '-';
35 str[11] = (flags & PARTIAL_EXEC) ? 'x' : '-';
36 str[12] = (flags & DELAY_CALL) ? 'd' : '-';
37 str[13] = '\0';
39 return str;
42 PUBLIC void mproc_dmp()
44 struct mproc *mp;
45 int i, n=0;
46 static int prev_i = 0;
48 printf("Process manager (PM) process table dump\n");
50 getsysinfo(PM_PROC_NR, SI_PROC_TAB, mproc);
52 printf("-process- -nr-pnr-tnr- --pid--ppid--pgrp- -uid-- -gid-- -nice- -flags-------\n");
53 for (i=prev_i; i<NR_PROCS; i++) {
54 mp = &mproc[i];
55 if (mp->mp_pid == 0 && i != PM_PROC_NR) continue;
56 if (++n > 22) break;
57 printf("%8.8s %4d%4d%4d %5d %5d %5d ",
58 mp->mp_name, i, mp->mp_parent, mp->mp_tracer, mp->mp_pid, mproc[mp->mp_parent].mp_pid, mp->mp_procgrp);
59 printf("%2d(%2d) %2d(%2d) ",
60 mp->mp_realuid, mp->mp_effuid, mp->mp_realgid, mp->mp_effgid);
61 printf(" %3d %s ",
62 mp->mp_nice, flags_str(mp->mp_flags));
63 printf("\n");
65 if (i >= NR_PROCS) i = 0;
66 else printf("--more--\r");
67 prev_i = i;
70 /*===========================================================================*
71 * sigaction_dmp *
72 *===========================================================================*/
73 PUBLIC void sigaction_dmp()
75 struct mproc *mp;
76 int i, n=0;
77 static int prev_i = 0;
78 clock_t uptime;
80 printf("Process manager (PM) signal action dump\n");
82 getsysinfo(PM_PROC_NR, SI_PROC_TAB, mproc);
83 getuptime(&uptime);
85 printf("-process- -nr- --ignore- --catch- --block- -tomess- -pending- -alarm---\n");
86 for (i=prev_i; i<NR_PROCS; i++) {
87 mp = &mproc[i];
88 if (mp->mp_pid == 0 && i != PM_PROC_NR) continue;
89 if (++n > 22) break;
90 printf("%8.8s %3d ", mp->mp_name, i);
91 printf(" %08x %08x %08x %08x ",
92 mp->mp_ignore, mp->mp_catch, mp->mp_sigmask, mp->mp_sig2mess);
93 printf("%08x ", mp->mp_sigpending);
94 if (mp->mp_flags & ALARM_ON) printf("%8u", mp->mp_timer.tmr_exp_time-uptime);
95 else printf(" -");
96 printf("\n");
98 if (i >= NR_PROCS) i = 0;
99 else printf("--more--\r");
100 prev_i = i;