Only in Proc-ProcessTable-0.31/Process: Makefile.old diff -c -r Proc-ProcessTable-0.31.orig/README.linux Proc-ProcessTable-0.31/README.linux *** Proc-ProcessTable-0.31.orig/README.linux Wed Jun 28 04:01:55 2000 --- Proc-ProcessTable-0.31/README.linux Mon Jun 18 00:01:48 2001 *************** *** 1,7 **** --- 1,13 ---- SUPPORTED ATTRIBUTES ==================== uid UID of process + euid Effective UID of process + suid Saved UID of process + fuid File UID of process gid GID of process + egid Effective GID of process + sgid Saved GID of process + fgid File GID of process pid process ID ppid parent process ID pgrp process group *************** *** 28,38 **** state state of process pctmem percent memory cmndline full command line of process ttydev path of process's tty TODO ==== ! It would be nice to get the euid and egid like solaris. BUGS ==== --- 34,46 ---- state state of process pctmem percent memory cmndline full command line of process + exec absolute filename (including path) of executed command ttydev path of process's tty + cwd current directory of process TODO ==== ! BUGS ==== diff -c -r Proc-ProcessTable-0.31.orig/os/Linux.c Proc-ProcessTable-0.31/os/Linux.c *** Proc-ProcessTable-0.31.orig/os/Linux.c Fri Jun 1 14:25:12 2001 --- Proc-ProcessTable-0.31/os/Linux.c Sun Jun 17 23:57:20 2001 *************** *** 132,137 **** --- 132,149 ---- size_t pagesize = getpagesize(); + /* used by exec, added by scip */ + size_t l_size; + char exec[ARG_MAX]; + + /* used by cwd, added by scip */ + char curdir[ARG_MAX]; + + /* used by the euid/egid stuff, added by scip */ + char entry[80]; + int dummyid, euid, suid, fuid, egid, sgid, fgid, line_count, i; + char c; + if( (procdir = opendir("/proc")) == NULL ){ return; } *************** *** 212,217 **** --- 224,289 ---- format[F_PCTMEM] = tolower(format[F_PCTMEM]); /* pctmem */ } + /* + * get the executable info, added by scip + * we do _not_ check if the readlink call failed, because + * we could simply not have permissions to read the link + * which then simply results in an empty "exec" field. + */ + sprintf(pathbuf, "%s%s%s", "/proc/", procdirp->d_name, "/exe"); + l_size = readlink(pathbuf, exec, PATH_MAX); + exec[l_size] = '\0'; + format[F_EXEC] = tolower(format[F_EXEC]); + + + + /* + * get the euid, egid and so on out of /proc/$$/status + * where the 2 lines in which we are interested in are: + * [5] Uid: 500 500 500 500 + * [6] Gid: 500 500 500 500 + * added by scip + */ + sprintf(pathbuf, "%s%s%s", "/proc/", procdirp->d_name, "/status"); + if ( (fp = fopen( pathbuf, "r" )) != NULL) { + while ( (c = fgetc(fp)) != EOF ) { + if (c == '\n') { + entry[i] = '\0'; + i = -1; + if (strncmp(entry, "Uid:", 4) == 0) { + /* Uid: entry */ + sscanf(entry, "Uid: %d %d %d %d", &dummyid, &euid, &suid, &fuid); + } + else if (strncmp(entry, "Gid:", 4) == 0) { + /* Gid: entry */ + sscanf(entry, "Gid: %d %d %d %d", &dummyid, &egid, &sgid, &fgid); + } + } + else { + entry[i] = c; + } + i++; + } + fclose(fp); + format[F_EUID] = tolower(format[F_EUID]); + format[F_SUID] = tolower(format[F_SUID]); + format[F_FUID] = tolower(format[F_FUID]); + format[F_EGID] = tolower(format[F_EGID]); + format[F_SGID] = tolower(format[F_SGID]); + format[F_FGID] = tolower(format[F_FGID]); + } + + + /* + * get the cwd info, added by scip + */ + sprintf(pathbuf, "%s%s%s", "/proc/", procdirp->d_name, "/cwd"); + l_size = readlink(pathbuf, curdir, PATH_MAX); + curdir[l_size] = '\0'; + format[F_CWD] = tolower(format[F_CWD]); + + + /* get stuff out of /proc/PROC_ID/cmdline */ sprintf(pathbuf, "%s%s%s", "/proc/", procdirp->d_name, "/cmdline"); if( (fp = fopen( pathbuf, "r" )) != NULL ){ *************** *** 269,275 **** pctcpu, state, pctmem, ! cmndline ); } } --- 341,351 ---- pctcpu, state, pctmem, ! cmndline, ! exec, ! euid, suid, fuid, ! egid, sgid, fgid, ! curdir ); } } diff -c -r Proc-ProcessTable-0.31.orig/os/Linux.h Proc-ProcessTable-0.31/os/Linux.h *** Proc-ProcessTable-0.31.orig/os/Linux.h Wed Jun 28 04:01:55 2000 --- Proc-ProcessTable-0.31/os/Linux.h Sun Jun 17 23:57:50 2001 *************** *** 75,81 **** /* We need to pass in a cap for ignore, lower for store on object */ /* We can just lc these! */ ! static char Defaultformat[] = "IIIIIIIIIIIIIIIIIIIIIISLSSSS"; /* Mapping of field to type */ static char* Fields[] = { --- 75,81 ---- /* We need to pass in a cap for ignore, lower for store on object */ /* We can just lc these! */ ! static char Defaultformat[] = "IIIIIIIIIIIIIIIIIIIIIISLSSSSSIIIIIIS"; /* Mapping of field to type */ static char* Fields[] = { *************** *** 160,167 **** "pctmem", #define F_PCTMEM 26 ! "cmndline" #define F_CMNDLINE 27 ! #define F_LASTFIELD 27 }; --- 160,191 ---- "pctmem", #define F_PCTMEM 26 ! "cmndline", #define F_CMNDLINE 27 ! "exec", ! #define F_EXEC 28 ! ! "euid", ! #define F_EUID 29 ! ! "suid", ! #define F_SUID 30 ! ! "fuid", ! #define F_FUID 31 ! ! "egid", ! #define F_EGID 32 ! ! "sgid", ! #define F_SGID 33 ! ! "fgid", ! #define F_FGID 34 ! ! "cwd" ! #define F_CWD 35 ! ! #define F_LASTFIELD 35 }; Only in Proc-ProcessTable-0.31: status