minix/servers/is/dmp_fs.c

88 lines
2.5 KiB
C
Raw Normal View History

2005-04-21 16:53:53 +02:00
/* This file contains procedures to dump to FS' data structures.
*
* The entry points into this file are
* dtab_dump: display device <-> driver mappings
2005-04-21 16:53:53 +02:00
* fproc_dump: display FS process table
*
* Created:
* Oct 01, 2004: by Jorrit N. Herder
*/
2005-10-20 22:28:54 +02:00
#include "inc.h"
#include "../mfs/const.h"
#include "../vfs/const.h"
#include "../vfs/fproc.h"
2007-08-07 15:26:25 +02:00
#include "../vfs/dmap.h"
#include <minix/dmap.h>
2005-04-21 16:53:53 +02:00
PUBLIC struct fproc fproc[NR_PROCS];
PUBLIC struct dmap dmap[NR_DEVICES];
2005-04-21 16:53:53 +02:00
/*===========================================================================*
* fproc_dmp *
*===========================================================================*/
PUBLIC void fproc_dmp()
2005-04-21 16:53:53 +02:00
{
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");
2006-06-28 12:04:32 +02:00
printf("-nr- -pid- -tty- -umask- --uid-- --gid-- -ldr- -sus-rev-proc-\n");
2005-04-21 16:53:53 +02:00
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 (%2d) %2d (%2d) %3d %3d %3d ",
i, fp->fp_pid,
2005-04-21 16:53:53 +02:00
((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_blocked_on, !!fp->fp_revived
2005-04-21 16:53:53 +02:00
);
if (fp->fp_blocked_on == FP_BLOCKED_ON_OTHER)
printf("%4d\n", fp->fp_task);
else
printf(" nil\n");
2005-04-21 16:53:53 +02:00
}
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];
strcpy(fl, "---");
if(flags & DMAP_MUTABLE) fl[0] = 'M';
if(flags & DMAP_BUSY) fl[1] = 'S';
if(flags & DMAP_BABY) fl[2] = 'B';
return fl;
}
2005-04-21 16:53:53 +02:00
/*===========================================================================*
* dtab_dmp *
*===========================================================================*/
PUBLIC void dtab_dmp()
2005-04-21 16:53:53 +02:00
{
int i;
getsysinfo(FS_PROC_NR, SI_DMAP_TAB, dmap);
printf("File System (FS) device <-> driver mappings\n");
endpoint-aware conversion of servers. 'who', indicating caller number in pm and fs and some other servers, has been removed in favour of 'who_e' (endpoint) and 'who_p' (proc nr.). In both PM and FS, isokendpt() convert endpoints to process slot numbers, returning OK if it was a valid and consistent endpoint number. okendpt() does the same but panic()s if it doesn't succeed. (In PM, this is pm_isok..) pm and fs keep their own records of process endpoints in their proc tables, which are needed to make kernel calls about those processes. message field names have changed. fs drivers are endpoints. fs now doesn't try to get out of driver deadlock, as the protocol isn't supposed to let that happen any more. (A warning is printed if ELOCKED is detected though.) fproc[].fp_task (indicating which driver the process is suspended on) became an int. PM and FS now get endpoint numbers of initial boot processes from the kernel. These happen to be the same as the old proc numbers, to let user processes reach them with the old numbers, but FS and PM don't know that. All new processes after INIT, even after the generation number wraps around, get endpoint numbers with generation 1 and higher, so the first instances of the boot processes are the only processes ever to have endpoint numbers in the old proc number range. More return code checks of sys_* functions have been added. IS has become endpoint-aware. Ditched the 'text' and 'data' fields in the kernel dump (which show locations, not sizes, so aren't terribly useful) in favour of the endpoint number. Proc number is still visible. Some other dumps (e.g. dmap, rs) show endpoint numbers now too which got the formatting changed. PM reading segments using rw_seg() has changed - it uses other fields in the message now instead of encoding the segment and process number and fd in the fd field. For that it uses _read_pm() and _write_pm() which to _taskcall()s directly in pm/misc.c. PM now sys_exit()s itself on panic(), instead of sys_abort(). RS also talks in endpoints instead of process numbers.
2006-03-03 11:20:58 +01:00
printf("Major Driver ept Flags\n");
printf("----- ---------- -----\n");
for (i=0; i<NR_DEVICES; i++) {
if (dmap[i].dmap_driver == NONE) continue;
endpoint-aware conversion of servers. 'who', indicating caller number in pm and fs and some other servers, has been removed in favour of 'who_e' (endpoint) and 'who_p' (proc nr.). In both PM and FS, isokendpt() convert endpoints to process slot numbers, returning OK if it was a valid and consistent endpoint number. okendpt() does the same but panic()s if it doesn't succeed. (In PM, this is pm_isok..) pm and fs keep their own records of process endpoints in their proc tables, which are needed to make kernel calls about those processes. message field names have changed. fs drivers are endpoints. fs now doesn't try to get out of driver deadlock, as the protocol isn't supposed to let that happen any more. (A warning is printed if ELOCKED is detected though.) fproc[].fp_task (indicating which driver the process is suspended on) became an int. PM and FS now get endpoint numbers of initial boot processes from the kernel. These happen to be the same as the old proc numbers, to let user processes reach them with the old numbers, but FS and PM don't know that. All new processes after INIT, even after the generation number wraps around, get endpoint numbers with generation 1 and higher, so the first instances of the boot processes are the only processes ever to have endpoint numbers in the old proc number range. More return code checks of sys_* functions have been added. IS has become endpoint-aware. Ditched the 'text' and 'data' fields in the kernel dump (which show locations, not sizes, so aren't terribly useful) in favour of the endpoint number. Proc number is still visible. Some other dumps (e.g. dmap, rs) show endpoint numbers now too which got the formatting changed. PM reading segments using rw_seg() has changed - it uses other fields in the message now instead of encoding the segment and process number and fd in the fd field. For that it uses _read_pm() and _write_pm() which to _taskcall()s directly in pm/misc.c. PM now sys_exit()s itself on panic(), instead of sys_abort(). RS also talks in endpoints instead of process numbers.
2006-03-03 11:20:58 +01:00
printf("%5d %10d %s\n",
i, dmap[i].dmap_driver, dmap_flags(dmap[i].dmap_flags));
2005-04-21 16:53:53 +02:00
}
}