]> granicus.if.org Git - procps-ng/commitdiff
ps: exploited that newly added field 'executable path'
authorJim Warner <james.warner@comcast.net>
Fri, 22 Jun 2018 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@enc.com.au>
Tue, 26 Jun 2018 11:25:18 +0000 (21:25 +1000)
Signed-off-by: Jim Warner <james.warner@comcast.net>
ps/common.h
ps/global.c
ps/output.c
ps/ps.1

index 9c47173436400e5645fa2a7a6b165d2c39f8538a..5bf8cb749f1f0c298508f72535951e2746b38fec 100644 (file)
@@ -75,6 +75,7 @@ makEXT(CGROUP)
 makEXT(CMD)
 makEXT(CMDLINE)
 makEXT(ENVIRON)
+makEXT(EXE)
 makEXT(FLAGS)
 makEXT(FLT_MAJ)
 makEXT(FLT_MAJ_C)
index 31eee6004aae7e2353a27fbd3838e35807ede1db..3ef8926d49da4ac2eb5998dc8c7447c54265fc3b 100644 (file)
@@ -65,6 +65,7 @@ makREL(CGROUP)
 makREL(CMD)
 makREL(CMDLINE)
 makREL(ENVIRON)
+makREL(EXE)
 makREL(FLAGS)
 makREL(FLT_MAJ)
 makREL(FLT_MAJ_C)
index 07b1c0d51a5cdcf567662276a22e76cc9b65f382..ef05b6cc1aaa38743c950c5d6cbda8aa237bfc54 100644 (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},
diff --git a/ps/ps.1 b/ps/ps.1
index 547b3de7b56cd0e19a36442c3f04c6920183a7e9..82f973b99b091c3c6c93ce19d45c5078b012d6a1 100644 (file)
--- a/ps/ps.1
+++ b/ps/ps.1
@@ -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