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

34
pgrep.c
View File

@ -52,18 +52,18 @@
#include <proc/procps.h>
enum pids_item Items[] = {
PROCPS_PIDS_ID_PID,
PROCPS_PIDS_ID_PPID,
PROCPS_PIDS_ID_PGRP,
PROCPS_PIDS_ID_EUID,
PROCPS_PIDS_ID_RUID,
PROCPS_PIDS_ID_RGID,
PROCPS_PIDS_ID_SESSION,
PROCPS_PIDS_ID_TGID,
PROCPS_PIDS_TIME_START,
PROCPS_PIDS_TTY_NAME,
PROCPS_PIDS_CMD,
PROCPS_PIDS_CMDLINE
PIDS_ID_PID,
PIDS_ID_PPID,
PIDS_ID_PGRP,
PIDS_ID_EUID,
PIDS_ID_RUID,
PIDS_ID_RGID,
PIDS_ID_SESSION,
PIDS_ID_TGID,
PIDS_TIME_START,
PIDS_TTY_NAME,
PIDS_CMD,
PIDS_CMDLINE
};
enum rel_items {
EU_PID, EU_PPID, EU_PGRP, EU_EUID, EU_RUID, EU_RGID, EU_SESSION,
@ -471,9 +471,9 @@ static regex_t * do_regcomp (void)
static struct el * select_procs (int *num)
{
#define PIDS_GETINT(e) PROCPS_PIDS_VAL(EU_ ## e, s_int, stack)
#define PIDS_GETULL(e) PROCPS_PIDS_VAL(EU_ ## e, ull_int, stack)
#define PIDS_GETSTR(e) PROCPS_PIDS_VAL(EU_ ## e, str, stack)
#define PIDS_GETINT(e) PIDS_VAL(EU_ ## e, s_int, stack)
#define PIDS_GETULL(e) PIDS_VAL(EU_ ## e, ull_int, stack)
#define PIDS_GETSTR(e) PIDS_VAL(EU_ ## e, str, stack)
struct pids_info *info=NULL;
struct procps_namespaces nsp;
struct pids_stack *stack;
@ -504,9 +504,9 @@ static struct el * select_procs (int *num)
if (procps_pids_new(&info, Items, 12) < 0)
xerrx(EXIT_FATAL,
_("Unable to create pid info structure"));
which = PROCPS_FETCH_TASKS_ONLY;
which = PIDS_FETCH_TASKS_ONLY;
if (opt_threads && !i_am_pkill)
which = PROCPS_FETCH_THREADS_TOO;
which = PIDS_FETCH_THREADS_TOO;
while ((stack = procps_pids_get(info, which))) {
int match = 1;