ps: exploited that newly added field 'executable path'

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2018-06-22 00:00:00 -05:00 committed by Craig Small
parent 1801bacc0d
commit 6658492df6
4 changed files with 17 additions and 0 deletions

View File

@ -75,6 +75,7 @@ makEXT(CGROUP)
makEXT(CMD)
makEXT(CMDLINE)
makEXT(ENVIRON)
makEXT(EXE)
makEXT(FLAGS)
makEXT(FLT_MAJ)
makEXT(FLT_MAJ_C)

View File

@ -65,6 +65,7 @@ makREL(CGROUP)
makREL(CMD)
makREL(CMDLINE)
makREL(ENVIRON)
makREL(EXE)
makREL(FLAGS)
makREL(FLT_MAJ)
makREL(FLT_MAJ_C)

View File

@ -1159,6 +1159,12 @@ setREL2(STATE,PROCESSOR)
return snprintf(outbuf, COLWID, "*");
}
/* full path to executable */
static int pr_exe(char *restrict const outbuf, const proc_t *restrict const pp){
setREL1(EXE)
return snprintf(outbuf, COLWID, "%s", rSv(EXE, str, pp));
}
/************************* Systemd stuff ********************************/
static int pr_sd_unit(char *restrict const outbuf, const proc_t *restrict const pp){
setREL1(SD_UNIT)
@ -1442,6 +1448,7 @@ static const format_struct format_array[] = { /*
{"etimes", "ELAPSED", pr_etimes, PIDS_TIME_ELAPSED, 7, BSD, ET|RIGHT}, /* FreeBSD */
{"euid", "EUID", pr_euid, PIDS_ID_EUID, 5, LNX, ET|RIGHT},
{"euser", "EUSER", pr_euser, PIDS_ID_EUSER, 8, LNX, ET|USER},
{"exe", "EXE", pr_exe, PIDS_EXE, 27, LNX, PO|UNLIMITED},
{"f", "F", pr_flag, PIDS_FLAGS, 1, XXX, ET|RIGHT}, /*flags*/
{"fgid", "FGID", pr_fgid, PIDS_FLAGS, 5, LNX, ET|RIGHT},
{"fgroup", "FGROUP", pr_fgroup, PIDS_ID_FGROUP, 8, LNX, ET|USER},

View File

@ -1243,6 +1243,14 @@ option can be used to force the decimal representation. (alias
.BR uname , \ user ).
T}
exe EXE T{
path to the executable. Useful if path cannot be printed via
.BR cmd ", " comm
or
.BR args
format options.
T}
f F T{
flags associated with the process, see the
.B PROCESS FLAGS