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
|
2005-06-07 16:43:35 +02:00
|
|
|
* 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"
|
2006-10-25 15:40:36 +02:00
|
|
|
#include "../mfs/const.h"
|
2011-08-17 15:23:45 +02:00
|
|
|
#if defined(_USEAVFS)
|
|
|
|
# include "../avfs/const.h"
|
|
|
|
# include "../avfs/fproc.h"
|
|
|
|
# include "../avfs/dmap.h"
|
|
|
|
#else
|
|
|
|
# include "../vfs/const.h"
|
|
|
|
# include "../vfs/fproc.h"
|
|
|
|
# include "../vfs/dmap.h"
|
|
|
|
#endif
|
2005-08-02 17:29:17 +02:00
|
|
|
#include <minix/dmap.h>
|
2005-04-21 16:53:53 +02:00
|
|
|
|
2005-06-07 16:43:35 +02:00
|
|
|
PUBLIC struct fproc fproc[NR_PROCS];
|
|
|
|
PUBLIC struct dmap dmap[NR_DEVICES];
|
2005-04-21 16:53:53 +02:00
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* fproc_dmp *
|
|
|
|
*===========================================================================*/
|
2005-06-07 16:43:35 +02:00
|
|
|
PUBLIC void fproc_dmp()
|
2005-04-21 16:53:53 +02:00
|
|
|
{
|
|
|
|
struct fproc *fp;
|
|
|
|
int i, n=0;
|
|
|
|
static int prev_i;
|
|
|
|
|
2011-12-11 22:30:35 +01:00
|
|
|
if (getsysinfo(VFS_PROC_NR, SI_PROC_TAB, fproc, sizeof(fproc)) != OK) {
|
|
|
|
printf("Error obtaining table from VFS. Perhaps recompile IS?\n");
|
|
|
|
return;
|
|
|
|
}
|
2005-06-07 16:43:35 +02:00
|
|
|
|
|
|
|
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;
|
2011-08-17 18:27:46 +02:00
|
|
|
#if !defined(_USEAVFS)
|
2009-11-03 00:04:52 +01:00
|
|
|
printf("%3d %4d %2d/%d 0x%05x %2d (%2d) %2d (%2d) %3d %3d %3d ",
|
2005-05-13 10:57:08 +02:00
|
|
|
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,
|
2009-11-03 00:04:52 +01:00
|
|
|
fp->fp_blocked_on, !!fp->fp_revived
|
2005-04-21 16:53:53 +02:00
|
|
|
);
|
2011-08-17 15:23:45 +02:00
|
|
|
#else
|
|
|
|
printf("%3d %4d %2d/%d 0x%05x %2d (%2d) %2d (%2d) %3d %3d %3d ",
|
|
|
|
i, fp->fp_pid,
|
|
|
|
major(fp->fp_tty), minor(fp->fp_tty),
|
|
|
|
fp->fp_umask,
|
|
|
|
fp->fp_realuid, fp->fp_effuid, fp->fp_realgid, fp->fp_effgid,
|
|
|
|
!!(fp->fp_flags & FP_SESLDR),
|
|
|
|
fp->fp_blocked_on, !!(fp->fp_flags & FP_REVIVED)
|
|
|
|
);
|
|
|
|
#endif
|
2009-09-22 23:48:26 +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;
|
|
|
|
}
|
|
|
|
|
2005-10-05 17:38:15 +02:00
|
|
|
/*===========================================================================*
|
|
|
|
* dmap_flags *
|
|
|
|
*===========================================================================*/
|
|
|
|
PRIVATE char * dmap_flags(int flags)
|
|
|
|
{
|
|
|
|
static char fl[10];
|
2010-04-09 23:56:44 +02:00
|
|
|
strcpy(fl, "-----");
|
|
|
|
if(flags & DRV_FORCED) fl[0] = 'F';
|
2005-10-05 17:38:15 +02:00
|
|
|
return fl;
|
|
|
|
}
|
|
|
|
|
2010-04-09 23:56:44 +02:00
|
|
|
/*===========================================================================*
|
|
|
|
* dmap_style *
|
|
|
|
*===========================================================================*/
|
|
|
|
PRIVATE char * dmap_style(int dev_style)
|
|
|
|
{
|
|
|
|
static char str[16];
|
|
|
|
switch(dev_style) {
|
|
|
|
case STYLE_DEV: strcpy(str, "STYLE_DEV"); break;
|
|
|
|
case STYLE_DEVA: strcpy(str, "STYLE_DEVA"); break;
|
|
|
|
case STYLE_TTY: strcpy(str, "STYLE_TTY"); break;
|
|
|
|
case STYLE_CTTY: strcpy(str, "STYLE_CTTY"); break;
|
|
|
|
case STYLE_CLONE: strcpy(str, "STYLE_CLONE"); break;
|
2011-07-27 14:23:03 +02:00
|
|
|
case STYLE_CLONE_A: strcpy(str, "STYLE_CLONE_A"); break;
|
2010-04-09 23:56:44 +02:00
|
|
|
default: strcpy(str, "UNKNOWN"); break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
/*===========================================================================*
|
|
|
|
* dtab_dmp *
|
|
|
|
*===========================================================================*/
|
2005-06-07 16:43:35 +02:00
|
|
|
PUBLIC void dtab_dmp()
|
2005-04-21 16:53:53 +02:00
|
|
|
{
|
|
|
|
int i;
|
2005-06-07 16:43:35 +02:00
|
|
|
|
2011-12-11 22:30:35 +01:00
|
|
|
if (getsysinfo(VFS_PROC_NR, SI_DMAP_TAB, dmap, sizeof(dmap)) != OK) {
|
|
|
|
printf("Error obtaining table from VFS. Perhaps recompile IS?\n");
|
|
|
|
return;
|
|
|
|
}
|
2005-06-07 16:43:35 +02:00
|
|
|
|
|
|
|
printf("File System (FS) device <-> driver mappings\n");
|
2010-04-09 23:56:44 +02:00
|
|
|
printf(" Label Major Driver ept Flags Style \n");
|
|
|
|
printf("------------- ----- ---------- ----- -------------\n");
|
2005-06-07 16:43:35 +02:00
|
|
|
for (i=0; i<NR_DEVICES; i++) {
|
2005-10-10 16:27:41 +02:00
|
|
|
if (dmap[i].dmap_driver == NONE) continue;
|
2010-04-09 23:56:44 +02:00
|
|
|
printf("%13s %5d %10d %s %-13s\n",
|
|
|
|
dmap[i].dmap_label, i, dmap[i].dmap_driver,
|
|
|
|
dmap_flags(dmap[i].dmap_flags), dmap_style(dmap[i].dmap_style));
|
2005-04-21 16:53:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|