1 | /* This file contains procedures to dump to FS' data structures.
|
---|
2 | *
|
---|
3 | * The entry points into this file are
|
---|
4 | * dtab_dump: display device <-> driver mappings
|
---|
5 | * fproc_dump: display FS process table
|
---|
6 | *
|
---|
7 | * Created:
|
---|
8 | * Oct 01, 2004: by Jorrit N. Herder
|
---|
9 | */
|
---|
10 |
|
---|
11 | #include "inc.h"
|
---|
12 | #include "../fs/const.h"
|
---|
13 | #include "../fs/fproc.h"
|
---|
14 | #include <minix/dmap.h>
|
---|
15 |
|
---|
16 | PUBLIC struct fproc fproc[NR_PROCS];
|
---|
17 | PUBLIC struct dmap dmap[NR_DEVICES];
|
---|
18 |
|
---|
19 | /*===========================================================================*
|
---|
20 | * fproc_dmp *
|
---|
21 | *===========================================================================*/
|
---|
22 | PUBLIC void fproc_dmp()
|
---|
23 | {
|
---|
24 | struct fproc *fp;
|
---|
25 | int i, n=0;
|
---|
26 | static int prev_i;
|
---|
27 |
|
---|
28 | getsysinfo(FS_PROC_NR, SI_PROC_TAB, fproc);
|
---|
29 |
|
---|
30 | printf("File System (FS) process table dump\n");
|
---|
31 | printf("-nr- -pid- -tty- -umask- --uid-- --gid-- -ldr- -sus-rev-proc- -cloexec-\n");
|
---|
32 | for (i=prev_i; i<NR_PROCS; i++) {
|
---|
33 | fp = &fproc[i];
|
---|
34 | if (fp->fp_pid <= 0) continue;
|
---|
35 | if (++n > 22) break;
|
---|
36 | printf("%3d %4d %2d/%d 0x%05x %2d (%d) %2d (%d) %3d %3d %3d %4d 0x%05x\n",
|
---|
37 | i, fp->fp_pid,
|
---|
38 | ((fp->fp_tty>>MAJOR)&BYTE), ((fp->fp_tty>>MINOR)&BYTE),
|
---|
39 | fp->fp_umask,
|
---|
40 | fp->fp_realuid, fp->fp_effuid, fp->fp_realgid, fp->fp_effgid,
|
---|
41 | fp->fp_sesldr,
|
---|
42 | fp->fp_suspended, fp->fp_revived, fp->fp_task,
|
---|
43 | fp->fp_cloexec
|
---|
44 | );
|
---|
45 | }
|
---|
46 | if (i >= NR_PROCS) i = 0;
|
---|
47 | else printf("--more--\r");
|
---|
48 | prev_i = i;
|
---|
49 | }
|
---|
50 |
|
---|
51 | /*===========================================================================*
|
---|
52 | * dmap_flags *
|
---|
53 | *===========================================================================*/
|
---|
54 | PRIVATE char * dmap_flags(int flags)
|
---|
55 | {
|
---|
56 | static char fl[10];
|
---|
57 | strcpy(fl, "---");
|
---|
58 | if(flags & DMAP_MUTABLE) fl[0] = 'M';
|
---|
59 | if(flags & DMAP_BUSY) fl[1] = 'S';
|
---|
60 | if(flags & DMAP_BABY) fl[2] = 'B';
|
---|
61 | return fl;
|
---|
62 | }
|
---|
63 |
|
---|
64 | /*===========================================================================*
|
---|
65 | * dtab_dmp *
|
---|
66 | *===========================================================================*/
|
---|
67 | PUBLIC void dtab_dmp()
|
---|
68 | {
|
---|
69 | int i;
|
---|
70 |
|
---|
71 | getsysinfo(FS_PROC_NR, SI_DMAP_TAB, dmap);
|
---|
72 |
|
---|
73 | printf("File System (FS) device <-> driver mappings\n");
|
---|
74 | printf("Major Driver ept Flags\n");
|
---|
75 | printf("----- ---------- -----\n");
|
---|
76 | for (i=0; i<NR_DEVICES; i++) {
|
---|
77 | if (dmap[i].dmap_driver == NONE) continue;
|
---|
78 | printf("%5d %10d %s\n",
|
---|
79 | i, dmap[i].dmap_driver, dmap_flags(dmap[i].dmap_flags));
|
---|
80 | }
|
---|
81 | }
|
---|
82 |
|
---|