library: add real string vectors to the pids interface

After experimenting with an adaptation of pidof to the
new pids interface, it became apparent that vectorized
versions of those command lines would be necessary. So
this commit adds that option and the strv result type.

And since the stage had been set, a vectorized version
of PROCPS_PIDS_ENVIRON & PROCPS_PIDS_CGROUP was added.

Lastly, any use of 'const' in the result structure was
removed so callers need not be bothered with casts and
compiler warnings. Hopefully, they'll respect a stack.

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2015-08-26 00:00:00 -05:00
committed by Craig Small
parent 9ecc0c8473
commit f69c421295
2 changed files with 170 additions and 130 deletions

View File

@@ -33,9 +33,12 @@ enum pids_item {
PROCPS_PIDS_ADDR_START_STACK, // addr
PROCPS_PIDS_ALARM, // sl_int
PROCPS_PIDS_CGROUP, // str
PROCPS_PIDS_CGROUP_V, // strv
PROCPS_PIDS_CMD, // str
PROCPS_PIDS_CMDLINE, // str
PROCPS_PIDS_CMDLINE_V, // strv
PROCPS_PIDS_ENVIRON, // str
PROCPS_PIDS_ENVIRON_V, // strv
PROCPS_PIDS_EXIT_SIGNAL, // s_int
PROCPS_PIDS_FLAGS, // ul_int
PROCPS_PIDS_FLT_MAJ, // ul_int
@@ -162,7 +165,8 @@ struct pids_result {
unsigned long ul_int;
unsigned long long ull_int;
void * addr;
const char * str;
char * str;
char ** strv;
} result;
};