dmp_fs.c

Go to the documentation of this file.
00001 /* This file contains procedures to dump to FS' data structures.
00002  *
00003  * The entry points into this file are
00004  *   dtab_dump:         display device <-> driver mappings        
00005  *   fproc_dump:        display FS process table          
00006  *
00007  * Created:
00008  *   Oct 01, 2004:      by Jorrit N. Herder
00009  */
00010 
00011 #include "inc.h"
00012 #include "../fs/const.h"
00013 #include "../fs/fproc.h"
00014 #include <minix/dmap.h>
00015 
00016 PUBLIC struct fproc fproc[NR_PROCS];
00017 PUBLIC struct dmap dmap[NR_DEVICES];
00018 
00019 /*===========================================================================*
00020  *                              fproc_dmp                                    *
00021  *===========================================================================*/
00022 PUBLIC void fproc_dmp()
00023 {
00024   struct fproc *fp;
00025   int i, n=0;
00026   static int prev_i;
00027 
00028   getsysinfo(FS_PROC_NR, SI_PROC_TAB, fproc);
00029 
00030   printf("File System (FS) process table dump\n");
00031   printf("-nr- -pid- -tty- -umask- --uid-- --gid-- -ldr- -sus-rev-proc- -cloexec-\n");
00032   for (i=prev_i; i<NR_PROCS; i++) {
00033         fp = &fproc[i];
00034         if (fp->fp_pid <= 0) continue;
00035         if (++n > 22) break;
00036         printf("%3d  %4d  %2d/%d  0x%05x %2d (%d)  %2d (%d)  %3d   %3d %3d %4d    0x%05x\n",
00037                 i, fp->fp_pid, 
00038                 ((fp->fp_tty>>MAJOR)&BYTE), ((fp->fp_tty>>MINOR)&BYTE), 
00039                 fp->fp_umask,
00040                 fp->fp_realuid, fp->fp_effuid, fp->fp_realgid, fp->fp_effgid,
00041                 fp->fp_sesldr,
00042                 fp->fp_suspended, fp->fp_revived, fp->fp_task,
00043                 fp->fp_cloexec
00044         );
00045   }
00046   if (i >= NR_PROCS) i = 0;
00047   else printf("--more--\r");
00048   prev_i = i;
00049 }
00050 
00051 /*===========================================================================*
00052  *                              dmap_flags                                   *
00053  *===========================================================================*/
00054 PRIVATE char * dmap_flags(int flags)
00055 {
00056         static char fl[10];
00057         strcpy(fl, "---");
00058         if(flags & DMAP_MUTABLE) fl[0] = 'M';
00059         if(flags & DMAP_BUSY)    fl[1] = 'S';
00060         if(flags & DMAP_BABY)    fl[2] = 'B';
00061         return fl;
00062 }
00063 
00064 /*===========================================================================*
00065  *                              dtab_dmp                                     *
00066  *===========================================================================*/
00067 PUBLIC void dtab_dmp()
00068 {
00069     int i;
00070 
00071     getsysinfo(FS_PROC_NR, SI_DMAP_TAB, dmap);
00072     
00073     printf("File System (FS) device <-> driver mappings\n");
00074     printf("Major  Driver ept  Flags\n");
00075     printf("-----  ----------  -----\n");
00076     for (i=0; i<NR_DEVICES; i++) {
00077         if (dmap[i].dmap_driver == NONE) continue;
00078         printf("%5d  %10d  %s\n",
00079                 i, dmap[i].dmap_driver, dmap_flags(dmap[i].dmap_flags));
00080     }
00081 }
00082 

Generated on Fri Apr 14 22:57:31 2006 for minix by  doxygen 1.4.6