#define PRG_MODULE "$Rcsfile$" #define PRG_VERSION " $Revision$ " /* ** Package : ** General Description ** ** ** Modification History ** ** Rev: Date Initials Reason ** ---- ---- -------- ------ **$Log$ ** ** ** Compile/Build Instructions ** ** ** */ /* ** PREPROCESSOR */ #include #include #include #include #include #include #include #include /* needed for process state constants */ #include /* needed for process state constants */ #include #include #include #include #include #include #include /* As of version 5.005_something it seems sv_undef has been supplanted by PL_sv_undef. */ #ifdef sv_undef #define PL_sv_undef sv_undef #endif /* How many processes to get at once from table() */ #define PROCCNT 8 /* ** PROTOTYPES */ /* prototypes to make the compiler shut up */ /* ** EXTERNALS */ main (int argc, char *argv) { /* ** FUNCTIONS */ /* ** ARRAYS */ char sFilename[16+1]; char pathbuf[MAXPATHLEN+1]; /* ** SCALARS */ int ifd = 0; int maxproc = 0; int procnum = 0; int procbase = 0; int psdata = 0; int nproc = 0; int idx1 = 0; int idx2 = 0; int ret = 0; /* ** POINTERS */ /* ** STRUCTURES and UNIONS */ struct statvfs svfs; /* defined in */ struct tbl_procinfo pstbl[PROCCNT]; /* defined in */ struct prpsinfo psbuf; struct prcred pscredbuf; /* ** WINDOWS and FILES */ /* ** BEGIN MAIN PROCESSING */ if( statvfs("/proc", &svfs) == -1 ) { (void) fprintf(stderr, "/proc unavailable...ABORTING\n"); exit(1); } /* Make sure /proc is mounted */ nproc = table(TBL_PROCINFO, 0, 0, MAXINT, 0); /* loop over all processes */ (void) fprintf(stderr, "PID\tfname\tpsargs\n"); (void) fprintf(stderr, "------------------------------------------------\n"); for (idx1=0; idx1