IS: dump number of in-use FDs for VFS

Change-Id: If0e2092d5a8c384c31b1f44cc0591bb119c6d8de
This commit is contained in:
David van Moolenbroek 2013-10-05 14:59:59 +02:00 committed by Lionel Sambuc
parent b058039a35
commit cf12dbac0d

View file

@ -24,7 +24,7 @@ struct dmap dmap[NR_DEVICES];
void fproc_dmp() void fproc_dmp()
{ {
struct fproc *fp; struct fproc *fp;
int i, n=0; int i, j, nfds, n=0;
static int prev_i; static int prev_i;
if (getsysinfo(VFS_PROC_NR, SI_PROC_TAB, fproc, sizeof(fproc)) != OK) { if (getsysinfo(VFS_PROC_NR, SI_PROC_TAB, fproc, sizeof(fproc)) != OK) {
@ -33,17 +33,19 @@ void fproc_dmp()
} }
printf("File System (FS) process table dump\n"); printf("File System (FS) process table dump\n");
printf("-nr- -pid- -tty- -umask- --uid-- --gid-- -ldr- -sus-rev-proc-\n"); printf("-nr- -pid- -tty- -umask- --uid-- --gid-- -ldr-fds-sus-rev-proc-\n");
for (i=prev_i; i<NR_PROCS; i++) { for (i=prev_i; i<NR_PROCS; i++) {
fp = &fproc[i]; fp = &fproc[i];
if (fp->fp_pid <= 0) continue; if (fp->fp_pid <= 0) continue;
if (++n > 22) break; if (++n > 22) break;
printf("%3d %4d %2d/%d 0x%05x %2d (%2d) %2d (%2d) %3d %3d %3d ", for (j = nfds = 0; j < OPEN_MAX; j++)
if (fp->fp_filp[j] != NULL) nfds++;
printf("%3d %4d %2d/%d 0x%05x %2d (%2d) %2d (%2d) %3d %3d %3d %3d ",
i, fp->fp_pid, i, fp->fp_pid,
major(fp->fp_tty), minor(fp->fp_tty), major(fp->fp_tty), minor(fp->fp_tty),
fp->fp_umask, fp->fp_umask,
fp->fp_realuid, fp->fp_effuid, fp->fp_realgid, fp->fp_effgid, fp->fp_realuid, fp->fp_effuid, fp->fp_realgid, fp->fp_effgid,
!!(fp->fp_flags & FP_SESLDR), !!(fp->fp_flags & FP_SESLDR), nfds,
fp->fp_blocked_on, !!(fp->fp_flags & FP_REVIVED) fp->fp_blocked_on, !!(fp->fp_flags & FP_REVIVED)
); );
if (fp->fp_blocked_on == FP_BLOCKED_ON_OTHER) if (fp->fp_blocked_on == FP_BLOCKED_ON_OTHER)