minix/servers/is/dmp_fs.c
Ben Gras 86ed54ee94 FS:
. unmap device drivers from dmap when PM signals they are dead
	. new null-io function (no_dev_io) to fill in for io functions
	  of unmapped drivers
	. driver (process number) of unmapped drivers is NONE instead of
	  0 (a valid process number)

IS:
	. print mutable flag of dmap table too

FS changes require sync() to be done 'manually' (currently by
reboot/shutdown) at shutdown time; could be caught by SIGTERM in
the future.
2005-10-05 15:38:15 +00:00

82 lines
2.3 KiB
C

/* This file contains procedures to dump to FS' data structures.
*
* The entry points into this file are
* dtab_dump: display device <-> driver mappings
* fproc_dump: display FS process table
*
* Created:
* Oct 01, 2004: by Jorrit N. Herder
*/
#include "is.h"
#include "../fs/const.h"
#include "../fs/fproc.h"
#include <minix/dmap.h>
PUBLIC struct fproc fproc[NR_PROCS];
PUBLIC struct dmap dmap[NR_DEVICES];
/*===========================================================================*
* fproc_dmp *
*===========================================================================*/
PUBLIC void fproc_dmp()
{
struct fproc *fp;
int i, n=0;
static int prev_i;
getsysinfo(FS_PROC_NR, SI_PROC_TAB, fproc);
printf("File System (FS) process table dump\n");
printf("-nr- -pid- -tty- -umask- --uid-- --gid-- -ldr- -sus-rev-proc- -cloexec-\n");
for (i=prev_i; i<NR_PROCS; i++) {
fp = &fproc[i];
if (fp->fp_pid <= 0) continue;
if (++n > 22) break;
printf("%3d %4d %2d/%d 0x%05x %2d (%d) %2d (%d) %3d %3d %3d %4d 0x%05x\n",
i, fp->fp_pid,
((fp->fp_tty>>MAJOR)&BYTE), ((fp->fp_tty>>MINOR)&BYTE),
fp->fp_umask,
fp->fp_realuid, fp->fp_effuid, fp->fp_realgid, fp->fp_effgid,
fp->fp_sesldr,
fp->fp_suspended, fp->fp_revived, fp->fp_task,
fp->fp_cloexec
);
}
if (i >= NR_PROCS) i = 0;
else printf("--more--\r");
prev_i = i;
}
/*===========================================================================*
* dmap_flags *
*===========================================================================*/
PRIVATE char * dmap_flags(int flags)
{
static char fl[10];
fl[0] = '-';
if(flags & DMAP_MUTABLE) fl[0] = 'M';
fl[1] = '\0';
return fl;
}
/*===========================================================================*
* dtab_dmp *
*===========================================================================*/
PUBLIC void dtab_dmp()
{
int i;
getsysinfo(FS_PROC_NR, SI_DMAP_TAB, dmap);
printf("File System (FS) device <-> driver mappings\n");
printf("Major Proc Flags\n");
printf("----- ---- -----\n");
for (i=0; i<NR_DEVICES; i++) {
if (dmap[i].dmap_driver == 0) continue;
printf("%5d %4d %s\n",
i, dmap[i].dmap_driver, dmap_flags(dmap[i].dmap_flags));
}
}