Remove building with NOCRYPTO option
[minix.git] / minix / servers / is / dmp_fs.c
blob53c675e8df661873de137def6bca0c92a2ff0608
1 /* This file contains procedures to dump to FS' data structures.
3 * The entry points into this file are
4 * dtab_dump: display device <-> driver mappings
5 * fproc_dump: display FS process table
7 * Created:
8 * Oct 01, 2004: by Jorrit N. Herder
9 */
11 #include "inc.h"
12 #include "mfs/const.h"
13 #include "vfs/const.h"
14 #include "vfs/fproc.h"
15 #include "vfs/dmap.h"
16 #include <minix/dmap.h>
18 struct fproc fproc[NR_PROCS];
19 struct dmap dmap[NR_DEVICES];
21 /*===========================================================================*
22 * fproc_dmp *
23 *===========================================================================*/
24 void
25 fproc_dmp(void)
27 struct fproc *fp;
28 int i, j, nfds, n=0;
29 static int prev_i;
31 if (getsysinfo(VFS_PROC_NR, SI_PROC_TAB, fproc, sizeof(fproc)) != OK) {
32 printf("Error obtaining table from VFS. Perhaps recompile IS?\n");
33 return;
36 printf("File System (FS) process table dump\n");
37 printf("-nr- -pid- -tty- -umask- --uid-- --gid-- -ldr-fds-sus-rev-proc-\n");
38 for (i=prev_i; i<NR_PROCS; i++) {
39 fp = &fproc[i];
40 if (fp->fp_pid <= 0) continue;
41 if (++n > 22) break;
42 for (j = nfds = 0; j < OPEN_MAX; j++)
43 if (fp->fp_filp[j] != NULL) nfds++;
44 printf("%3d %4d %2d/%d 0x%05x %2d (%2d) %2d (%2d) %3d %3d %3d %3d ",
45 i, fp->fp_pid,
46 major(fp->fp_tty), minor(fp->fp_tty),
47 fp->fp_umask,
48 fp->fp_realuid, fp->fp_effuid, fp->fp_realgid, fp->fp_effgid,
49 !!(fp->fp_flags & FP_SESLDR), nfds,
50 fp->fp_blocked_on, !!(fp->fp_flags & FP_REVIVED)
52 if (fp->fp_blocked_on == FP_BLOCKED_ON_CDEV)
53 printf("%4d\n", fp->fp_cdev.endpt);
54 /* TODO: for FP_BLOCKED_ON_SDEV we do not have the endpoint.. */
55 else
56 printf(" nil\n");
58 if (i >= NR_PROCS) i = 0;
59 else printf("--more--\r");
60 prev_i = i;
63 /*===========================================================================*
64 * dtab_dmp *
65 *===========================================================================*/
66 void
67 dtab_dmp(void)
69 int i;
71 if (getsysinfo(VFS_PROC_NR, SI_DMAP_TAB, dmap, sizeof(dmap)) != OK) {
72 printf("Error obtaining table from VFS. Perhaps recompile IS?\n");
73 return;
76 printf("File System (FS) device <-> driver mappings\n");
77 printf(" Label Major Driver ept\n");
78 printf("------------- ----- ----------\n");
79 for (i=0; i<NR_DEVICES; i++) {
80 if (dmap[i].dmap_driver == NONE) continue;
81 printf("%13s %5d %10d\n", dmap[i].dmap_label, i, dmap[i].dmap_driver);