minor fixes for safecopy & safemap tests
[minix.git] / servers / is / dmp_rs.c
blob362dd81ae6aab0f0d5ca1c2493a92b326074a4aa
1 /* This file contains procedures to dump RS data structures.
3 * The entry points into this file are
4 * rproc_dump: display RS system process table
6 * Created:
7 * Oct 03, 2005: by Jorrit N. Herder
8 */
10 #include "inc.h"
11 #include <timers.h>
12 #include <minix/rs.h>
13 #include "kernel/priv.h"
14 #include "../rs/const.h"
15 #include "../rs/type.h"
17 struct rprocpub rprocpub[NR_SYS_PROCS];
18 struct rproc rproc[NR_SYS_PROCS];
20 static char *s_flags_str(int flags, int sys_flags);
22 /*===========================================================================*
23 * rproc_dmp *
24 *===========================================================================*/
25 void rproc_dmp()
27 struct rproc *rp;
28 struct rprocpub *rpub;
29 int i, n=0;
30 static int prev_i=0;
32 if (getsysinfo(RS_PROC_NR, SI_PROCPUB_TAB, rprocpub, sizeof(rprocpub)) != OK
33 || getsysinfo(RS_PROC_NR, SI_PROC_TAB, rproc, sizeof(rproc)) != OK) {
34 printf("Error obtaining table from RS. Perhaps recompile IS?\n");
35 return;
38 printf("Reincarnation Server (RS) system process table dump\n");
39 printf("----label---- endpoint- -pid- flags- -dev- -T- alive_tm starts command\n");
40 for (i=prev_i; i<NR_SYS_PROCS; i++) {
41 rp = &rproc[i];
42 rpub = &rprocpub[i];
43 if (! (rp->r_flags & RS_IN_USE)) continue;
44 if (++n > 22) break;
45 printf("%13s %9d %5d %6s %3d/%1d %3ld %8ld %5dx %s",
46 rpub->label, rpub->endpoint, rp->r_pid,
47 s_flags_str(rp->r_flags, rpub->sys_flags), rpub->dev_nr,
48 rpub->dev_style, rp->r_period, rp->r_alive_tm, rp->r_restarts,
49 rp->r_args
51 printf("\n");
53 if (i >= NR_SYS_PROCS) i = 0;
54 else printf("--more--\r");
55 prev_i = i;
59 static char *s_flags_str(int flags, int sys_flags)
61 static char str[10];
62 str[0] = (flags & RS_ACTIVE) ? 'A' : '-';
63 str[1] = (flags & RS_UPDATING) ? 'U' : '-';
64 str[2] = (flags & RS_EXITING) ? 'E' : '-';
65 str[3] = (flags & RS_NOPINGREPLY) ? 'N' : '-';
66 str[4] = (sys_flags & SF_USE_COPY) ? 'C' : '-';
67 str[5] = (sys_flags & SF_USE_REPL) ? 'R' : '-';
68 str[6] = '\0';
70 return(str);