related: change for lost 'PROCPS_' enumerator prefixes

With this patch we've completed a progression toward a
standard approach to naming conventions which follows:

* Only functions will begin with that 'procps_' prefix
. ........................................... examples
. procps_vmstat_get ()
. procps_diskstats_select ()
- ----------------------------------------------------

* Exposed structures begin with the module/header name
. ........................................... examples
. struct pids_info
. struct stat_reaped
- ----------------------------------------------------

* Item enumerators begin like structs, but capitalized
. ........................................... examples
. VMSTAT_COMPACT_FAIL
. MEMINFO_DELTA_ACTIVE

[ slabinfo varies slightly due to some item variants ]
. SLABINFO_extra
. SLABS_SIZE_ACTIVE
. SLABNODE_OBJS_PER_SLAB
[ could cure with a prefix of SLABINFO, but too long ]
- ----------------------------------------------------

* Other enumerators work exactly like item enumerators
. ........................................... examples
. PIDS_SORT_ASCEND
. STAT_REAP_CPUS_AND_NODES
- ----------------------------------------------------

* Macros and constants begin just like the enumerators
. ........................................... examples
. #define SLABINFO_GET
. #define DISKSTATS_TYPE_DISK
- ----------------------------------------------------

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2016-07-21 00:00:00 -05:00
committed by Craig Small
parent c4d097c709
commit 612f36189e
15 changed files with 599 additions and 600 deletions

16
pmap.c
View File

@@ -38,8 +38,8 @@
#include <proc/procps.h>
enum pids_item Pid_items[] = {
PROCPS_PIDS_ID_PID, PROCPS_PIDS_ID_TGID,
PROCPS_PIDS_CMDLINE, PROCPS_PIDS_ADDR_START_STACK };
PIDS_ID_PID, PIDS_ID_TGID,
PIDS_CMDLINE, PIDS_ADDR_START_STACK };
enum rel_items { pid, tgid, cmdline, start_stack };
const char *nls_Address,
@@ -238,8 +238,8 @@ static char *mapping_name(struct pids_stack *p, unsigned long addr,
}
cp = _(" [ anon ]");
if (PROCPS_PIDS_VAL(start_stack, ul_int, p) >= addr
&& (PROCPS_PIDS_VAL(start_stack, ul_int, p) <= addr + len))
if (PIDS_VAL(start_stack, ul_int, p) >= addr
&& (PIDS_VAL(start_stack, ul_int, p) <= addr + len))
cp = _(" [ stack ]");
return cp;
}
@@ -534,14 +534,14 @@ static int one_proc (struct pids_stack *p)
unsigned long long total_shared_dirty = 0ull;
int maxw1=0, maxw2=0, maxw3=0, maxw4=0, maxw5=0;
printf("%u: %s\n", PROCPS_PIDS_VAL(tgid, s_int, p), PROCPS_PIDS_VAL(cmdline, str, p));
printf("%u: %s\n", PIDS_VAL(tgid, s_int, p), PIDS_VAL(cmdline, str, p));
if (x_option || X_option || c_option) {
sprintf(buf, "/proc/%u/smaps", PROCPS_PIDS_VAL(tgid, s_int, p));
sprintf(buf, "/proc/%u/smaps", PIDS_VAL(tgid, s_int, p));
if ((fp = fopen(buf, "r")) == NULL)
return 1;
} else {
sprintf(buf, "/proc/%u/maps", PROCPS_PIDS_VAL(tgid, s_int, p));
sprintf(buf, "/proc/%u/maps", PIDS_VAL(tgid, s_int, p));
if ((fp = fopen(buf, "r")) == NULL)
return 1;
}
@@ -1161,7 +1161,7 @@ int main(int argc, char **argv)
discover_shm_minor();
if (!(pids_fetch = procps_pids_select(info, pidlist, user_count, PROCPS_SELECT_PID)))
if (!(pids_fetch = procps_pids_select(info, pidlist, user_count, PIDS_SELECT_PID)))
xerrx(EXIT_FAILURE, _("library failed pids statistics"));
for (reap_count = 0; reap_count < pids_fetch->counts->total; reap_count++) {