]> granicus.if.org Git - procps-ng/commitdiff
misc: needed adaptations for the changes in <pids> api
authorJim Warner <james.warner@comcast.net>
Tue, 9 Mar 2021 06:00:00 +0000 (00:00 -0600)
committerCraig Small <csmall@dropbear.xyz>
Thu, 11 Mar 2021 10:21:23 +0000 (21:21 +1100)
That snowball, which began as a simple removal of some
brackets, now ends with this third patch restoring the
ability to build our project. It was made necessary by
the renaming (and rearranging) of several enumerators.

Signed-off-by: Jim Warner <james.warner@comcast.net>
pmap.c
ps/common.h
ps/global.c
ps/output.c

diff --git a/pmap.c b/pmap.c
index 421449710f3c66c7985a7b3a36beb8cc80e6fdb6..ff28947754aaa47c5a06dbe38ff7c219142db9be 100644 (file)
--- a/pmap.c
+++ b/pmap.c
@@ -43,7 +43,7 @@ static struct pids_info *Pids_info;
 
 enum pids_item Pid_items[] = {
     PIDS_ID_PID,  PIDS_ID_TGID,
-    PIDS_CMDLINE, PIDS_ADDR_START_STACK };
+    PIDS_CMDLINE, PIDS_ADDR_STACK_START };
 enum rel_items { pid, tgid, cmdline, start_stack };
 
 const char *nls_Address,
index 08af46a27302062c6abd291450e8f4d1f744b015..d0abca367f518d8904fcea997d38c5eb1a15a318 100644 (file)
@@ -68,11 +68,11 @@ extern int               Pids_index;
 
 // most of these need not be extern, they're unique to output.c
 // (but for future flexibility the easiest path has been taken)
-makEXT(ADDR_END_CODE)
-makEXT(ADDR_KSTK_EIP)
-makEXT(ADDR_KSTK_ESP)
-makEXT(ADDR_START_CODE)
-makEXT(ADDR_START_STACK)
+makEXT(ADDR_CODE_END)
+makEXT(ADDR_CODE_START)
+makEXT(ADDR_CURR_EIP)
+makEXT(ADDR_CURR_ESP)
+makEXT(ADDR_STACK_START)
 makEXT(CGNAME)
 makEXT(CGROUP)
 makEXT(CMD)
index 72d32a4245380fc0b7415d7578c8c06aa8e721c2..601aff3cba627986261a1af84878b42e4a568b59 100644 (file)
@@ -54,11 +54,11 @@ int Pids_index;                       // actual number of active enums
 
 // most of these could be defined as static in the output.c module
 // (but for future flexibility, the easiest route has been chosen)
-makREL(ADDR_END_CODE)
-makREL(ADDR_KSTK_EIP)
-makREL(ADDR_KSTK_ESP)
-makREL(ADDR_START_CODE)
-makREL(ADDR_START_STACK)
+makREL(ADDR_CODE_END)
+makREL(ADDR_CODE_START)
+makREL(ADDR_CURR_EIP)
+makREL(ADDR_CURR_ESP)
+makREL(ADDR_STACK_START)
 makREL(ALARM)
 makREL(CGNAME)
 makREL(CGROUP)
index e7f3a2cee3ca2470fa2af9047b3e4fc62ce5877d..1c6351e12af67da886366ba03d0ea4ef01b3a012 100644 (file)
@@ -873,18 +873,18 @@ tsiz      text size (in Kbytes)
 ***/
 
 static int pr_stackp(char *restrict const outbuf, const proc_t *restrict const pp){
-setREL1(ADDR_START_STACK)
-    return snprintf(outbuf, COLWID, "%0*lx", (int)(2*sizeof(long)), rSv(ADDR_START_STACK, ul_int, pp));
+setREL1(ADDR_STACK_START)
+    return snprintf(outbuf, COLWID, "%0*lx", (int)(2*sizeof(long)), rSv(ADDR_STACK_START, ul_int, pp));
 }
 
 static int pr_esp(char *restrict const outbuf, const proc_t *restrict const pp){
-setREL1(ADDR_KSTK_ESP)
-    return snprintf(outbuf, COLWID, "%0*lx", (int)(2*sizeof(long)), rSv(ADDR_KSTK_ESP, ul_int, pp));
+setREL1(ADDR_CURR_ESP)
+    return snprintf(outbuf, COLWID, "%0*lx", (int)(2*sizeof(long)), rSv(ADDR_CURR_ESP, ul_int, pp));
 }
 
 static int pr_eip(char *restrict const outbuf, const proc_t *restrict const pp){
-setREL1(ADDR_KSTK_EIP)
-    return snprintf(outbuf, COLWID, "%0*lx", (int)(2*sizeof(long)), rSv(ADDR_KSTK_EIP, ul_int, pp));
+setREL1(ADDR_CURR_EIP)
+    return snprintf(outbuf, COLWID, "%0*lx", (int)(2*sizeof(long)), rSv(ADDR_CURR_EIP, ul_int, pp));
 }
 
 static int pr_bsdtime(char *restrict const outbuf, const proc_t *restrict const pp){
@@ -934,36 +934,36 @@ setREL1(VM_SIZE)
 /* kB data size. See drs, tsiz & trs. */
 static int pr_dsiz(char *restrict const outbuf, const proc_t *restrict const pp){
     long dsiz;
-setREL3(VSIZE_PGS,ADDR_END_CODE,ADDR_START_CODE)
+setREL3(VSIZE_PGS,ADDR_CODE_END,ADDR_CODE_START)
     dsiz = 0;
-    if(rSv(VSIZE_PGS, ul_int, pp)) dsiz += (rSv(VSIZE_PGS, ul_int, pp) - rSv(ADDR_END_CODE, ul_int, pp) + rSv(ADDR_START_CODE, ul_int, pp)) >> 10;
+    if(rSv(VSIZE_PGS, ul_int, pp)) dsiz += (rSv(VSIZE_PGS, ul_int, pp) - rSv(ADDR_CODE_END, ul_int, pp) + rSv(ADDR_CODE_START, ul_int, pp)) >> 10;
     return snprintf(outbuf, COLWID, "%ld", dsiz);
 }
 
 /* kB text (code) size. See trs, dsiz & drs. */
 static int pr_tsiz(char *restrict const outbuf, const proc_t *restrict const pp){
     long tsiz;
-setREL3(VSIZE_PGS,ADDR_END_CODE,ADDR_START_CODE)
+setREL3(VSIZE_PGS,ADDR_CODE_END,ADDR_CODE_START)
     tsiz = 0;
-    if(rSv(VSIZE_PGS, ul_int, pp)) tsiz += (rSv(ADDR_END_CODE, ul_int, pp) - rSv(ADDR_START_CODE, ul_int, pp)) >> 10;
+    if(rSv(VSIZE_PGS, ul_int, pp)) tsiz += (rSv(ADDR_CODE_END, ul_int, pp) - rSv(ADDR_CODE_START, ul_int, pp)) >> 10;
     return snprintf(outbuf, COLWID, "%ld", tsiz);
 }
 
 /* kB _resident_ data size. See dsiz, tsiz & trs. */
 static int pr_drs(char *restrict const outbuf, const proc_t *restrict const pp){
     long drs;
-setREL3(VSIZE_PGS,ADDR_END_CODE,ADDR_START_CODE)
+setREL3(VSIZE_PGS,ADDR_CODE_END,ADDR_CODE_START)
     drs = 0;
-    if(rSv(VSIZE_PGS, ul_int, pp)) drs += (rSv(VSIZE_PGS, ul_int, pp) - rSv(ADDR_END_CODE, ul_int, pp) + rSv(ADDR_START_CODE, ul_int, pp)) >> 10;
+    if(rSv(VSIZE_PGS, ul_int, pp)) drs += (rSv(VSIZE_PGS, ul_int, pp) - rSv(ADDR_CODE_END, ul_int, pp) + rSv(ADDR_CODE_START, ul_int, pp)) >> 10;
     return snprintf(outbuf, COLWID, "%ld", drs);
 }
 
 /* kB text _resident_ (code) size. See tsiz, dsiz & drs. */
 static int pr_trs(char *restrict const outbuf, const proc_t *restrict const pp){
     long trs;
-setREL3(VSIZE_PGS,ADDR_END_CODE,ADDR_START_CODE)
+setREL3(VSIZE_PGS,ADDR_CODE_END,ADDR_CODE_START)
     trs = 0;
-    if(rSv(VSIZE_PGS, ul_int, pp)) trs += (rSv(ADDR_END_CODE, ul_int, pp) - rSv(ADDR_START_CODE, ul_int, pp)) >> 10;
+    if(rSv(VSIZE_PGS, ul_int, pp)) trs += (rSv(ADDR_CODE_END, ul_int, pp) - rSv(ADDR_CODE_START, ul_int, pp)) >> 10;
     return snprintf(outbuf, COLWID, "%ld", trs);
 }
 
@@ -1570,11 +1570,11 @@ static const format_struct format_array[] = { /*
 {"dsiz",      "DSIZ",    pr_dsiz,          PIDS_VSIZE_PGS,           4,    LNX,  PO|RIGHT},
 {"egid",      "EGID",    pr_egid,          PIDS_ID_EGID,             5,    LNX,  ET|RIGHT},
 {"egroup",    "EGROUP",  pr_egroup,        PIDS_ID_EGROUP,           8,    LNX,  ET|USER},
-{"eip",       "EIP",     pr_eip,           PIDS_ADDR_KSTK_EIP, (int)(2*sizeof(long)), LNX, TO|RIGHT},
+{"eip",       "EIP",     pr_eip,           PIDS_ADDR_CURR_EIP, (int)(2*sizeof(long)), LNX, TO|RIGHT},
 {"emul",      "EMUL",    pr_nop,           PIDS_noop,               13,    BSD,  PO|LEFT},  /* "FreeBSD ELF32" and such */
-{"end_code",  "E_CODE",  pr_nop,           PIDS_ADDR_END_CODE, (int)(2*sizeof(long)), LNx, PO|RIGHT}, // sortable, but unprintable ??
+{"end_code",  "E_CODE",  pr_nop,           PIDS_ADDR_CODE_END, (int)(2*sizeof(long)), LNx, PO|RIGHT}, // sortable, but unprintable ??
 {"environ","ENVIRONMENT",pr_nop,           PIDS_noop,               11,    LNx,  PO|UNLIMITED},
-{"esp",       "ESP",     pr_esp,           PIDS_ADDR_KSTK_ESP, (int)(2*sizeof(long)), LNX, TO|RIGHT},
+{"esp",       "ESP",     pr_esp,           PIDS_ADDR_CURR_ESP, (int)(2*sizeof(long)), LNX, TO|RIGHT},
 {"etime",     "ELAPSED", pr_etime,         PIDS_TIME_ELAPSED,       11,    U98,  ET|RIGHT}, /* was 7 wide */
 {"etimes",    "ELAPSED", pr_etimes,        PIDS_TIME_ELAPSED,        7,    BSD,  ET|RIGHT}, /* FreeBSD */
 {"euid",      "EUID",    pr_euid,          PIDS_ID_EUID,             5,    LNX,  ET|RIGHT},
@@ -1712,10 +1712,10 @@ static const format_struct format_array[] = { /*
 {"sl",        "SL",      pr_nop,           PIDS_noop,                3,    XXX,  AN|RIGHT},
 {"slice",      "SLICE",  pr_sd_slice,      PIDS_SD_SLICE,           31,    LNX,  ET|LEFT},
 {"spid",      "SPID",    pr_tasks,         PIDS_ID_PID,              5,    SGI,  TO|PIDMAX|RIGHT},
-{"stackp",    "STACKP",  pr_stackp,        PIDS_ADDR_START_STACK, (int)(2*sizeof(long)), LNX, PO|RIGHT}, /*start_stack*/
+{"stackp",    "STACKP",  pr_stackp,        PIDS_ADDR_STACK_START, (int)(2*sizeof(long)), LNX, PO|RIGHT}, /*start_stack*/
 {"start",     "STARTED", pr_start,         PIDS_TIME_START,          8,    XXX,  ET|RIGHT},
-{"start_code", "S_CODE", pr_nop,           PIDS_ADDR_START_CODE,  (int)(2*sizeof(long)), LNx, PO|RIGHT}, // sortable, but unprintable ??
-{"start_stack", "STACKP",pr_stackp,        PIDS_ADDR_START_STACK, (int)(2*sizeof(long)), LNX, PO|RIGHT}, /*stackp*/
+{"start_code", "S_CODE", pr_nop,           PIDS_ADDR_CODE_START,  (int)(2*sizeof(long)), LNx, PO|RIGHT}, // sortable, but unprintable ??
+{"start_stack", "STACKP",pr_stackp,        PIDS_ADDR_STACK_START, (int)(2*sizeof(long)), LNX, PO|RIGHT}, /*stackp*/
 {"start_time", "START",  pr_stime,         PIDS_TIME_START,          5,    LNx,  ET|RIGHT},
 {"stat",      "STAT",    pr_stat,          PIDS_STATE,               4,    BSD,  TO|LEFT},  /*state,s*/
 {"state",     "S",       pr_s,             PIDS_STATE,               1,    XXX,  TO|LEFT},  /*stat,s*/ /* was STAT */