1 | /* This file contains procedures to dump RS data structures.
|
---|
2 | *
|
---|
3 | * The entry points into this file are
|
---|
4 | * rproc_dump: display RS system process table
|
---|
5 | *
|
---|
6 | * Created:
|
---|
7 | * Oct 03, 2005: by Jorrit N. Herder
|
---|
8 | */
|
---|
9 |
|
---|
10 | #include "inc.h"
|
---|
11 | #include "../rs/manager.h"
|
---|
12 |
|
---|
13 | PUBLIC struct rproc rproc[NR_SYS_PROCS];
|
---|
14 |
|
---|
15 | FORWARD _PROTOTYPE( char *s_flags_str, (int flags) );
|
---|
16 |
|
---|
17 | /*===========================================================================*
|
---|
18 | * rproc_dmp *
|
---|
19 | *===========================================================================*/
|
---|
20 | PUBLIC void rproc_dmp()
|
---|
21 | {
|
---|
22 | struct rproc *rp;
|
---|
23 | int i,j, n=0;
|
---|
24 | static int prev_i=0;
|
---|
25 |
|
---|
26 | getsysinfo(RS_PROC_NR, SI_PROC_TAB, rproc);
|
---|
27 |
|
---|
28 | printf("Reincarnation Server (RS) system process table dump\n");
|
---|
29 | printf("-----proc---pid-flag--dev- -T---checked----alive-starts-backoff-command (argc)-\n");
|
---|
30 | for (i=prev_i; i<NR_SYS_PROCS; i++) {
|
---|
31 | rp = &rproc[i];
|
---|
32 | if (! rp->r_flags & RS_IN_USE) continue;
|
---|
33 | if (++n > 22) break;
|
---|
34 | printf("%9d %5d %s %3d/%2d %3u %8u %8u %4dx %3d %s (%d)",
|
---|
35 | rp->r_proc_nr_e, rp->r_pid,
|
---|
36 | s_flags_str(rp->r_flags),
|
---|
37 | rp->r_dev_nr, rp->r_dev_style,
|
---|
38 | rp->r_period,
|
---|
39 | rp->r_check_tm, rp->r_alive_tm,
|
---|
40 | rp->r_restarts, rp->r_backoff,
|
---|
41 | rp->r_cmd,
|
---|
42 | rp->r_argc
|
---|
43 | );
|
---|
44 | printf("\n");
|
---|
45 | }
|
---|
46 | if (i >= NR_SYS_PROCS) i = 0;
|
---|
47 | else printf("--more--\r");
|
---|
48 | prev_i = i;
|
---|
49 | }
|
---|
50 |
|
---|
51 |
|
---|
52 | PRIVATE char *s_flags_str(int flags)
|
---|
53 | {
|
---|
54 | static char str[5];
|
---|
55 | str[0] = (flags & RS_IN_USE) ? 'U' : '-';
|
---|
56 | str[1] = (flags & RS_EXITING) ? 'E' : '-';
|
---|
57 | str[2] = '-';
|
---|
58 | str[3] = '\0';
|
---|
59 |
|
---|
60 | return(str);
|
---|
61 | }
|
---|
62 |
|
---|