struct diskstats_reap results; // count + stacks for return to caller
};
-struct procps_diskstats {
+struct diskstats_info {
int refcount;
FILE *diskstats_fp;
time_t old_stamp; /* previous read seconds */
// --- dev_node specific support ----------------------------------------------
static struct dev_node *node_add (
- struct procps_diskstats *info,
+ struct diskstats_info *info,
struct dev_node *this)
{
struct dev_node *prev, *walk;
static struct dev_node *node_cut (
- struct procps_diskstats *info,
+ struct diskstats_info *info,
struct dev_node *this)
{
struct dev_node *node = info->nodes;
static struct dev_node *node_get (
- struct procps_diskstats *info,
+ struct diskstats_info *info,
const char *name)
{
struct dev_node *node = info->nodes;
static int node_update (
- struct procps_diskstats *info,
+ struct diskstats_info *info,
struct dev_node *source)
{
struct dev_node *target = node_get(info, source->name);
* Returns: 0 on success, negative on error
*/
static int read_diskstats_failed (
- struct procps_diskstats *info)
+ struct diskstats_info *info)
{
static const char *fmtstr = "%d %d %" STRINGIFY(DISKSTATS_NAME_LEN) \
"s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu";
static int stacks_fetch (
- struct procps_diskstats *info)
+ struct diskstats_info *info)
{
#define n_alloc info->fetch.n_alloc
#define n_inuse info->fetch.n_inuse
* a pointer to a new context struct
*/
PROCPS_EXPORT int procps_diskstats_new (
- struct procps_diskstats **info)
+ struct diskstats_info **info)
{
- struct procps_diskstats *p;
+ struct diskstats_info *p;
int rc;
if (info == NULL)
return -EINVAL;
- if (!(p = calloc(1, sizeof(struct procps_diskstats))))
+ if (!(p = calloc(1, sizeof(struct diskstats_info))))
return -ENOMEM;
p->refcount = 1;
PROCPS_EXPORT int procps_diskstats_ref (
- struct procps_diskstats *info)
+ struct diskstats_info *info)
{
if (info == NULL)
return -EINVAL;
PROCPS_EXPORT int procps_diskstats_unref (
- struct procps_diskstats **info)
+ struct diskstats_info **info)
{
struct dev_node *node;
// --- variable interface functions -------------------------------------------
PROCPS_EXPORT struct diskstats_result *procps_diskstats_get (
- struct procps_diskstats *info,
+ struct diskstats_info *info,
const char *name,
enum diskstats_item item)
{
* Returns: pointer to a diskstats_reap struct on success, NULL on error.
*/
PROCPS_EXPORT struct diskstats_reap *procps_diskstats_reap (
- struct procps_diskstats *info,
+ struct diskstats_info *info,
enum diskstats_item *items,
int numitems)
{
* Returns: pointer to a diskstats_stack struct on success, NULL on error.
*/
PROCPS_EXPORT struct diskstats_stack *procps_diskstats_select (
- struct procps_diskstats *info,
+ struct diskstats_info *info,
const char *name,
enum diskstats_item *items,
int numitems)
* Note: all of the stacks must be homogeneous (of equal length and content).
*/
PROCPS_EXPORT struct diskstats_stack **procps_diskstats_sort (
- struct procps_diskstats *info,
+ struct diskstats_info *info,
struct diskstats_stack *stacks[],
int numstacked,
enum diskstats_item sortitem,
#define PROCPS_DISKSTATS_TYPE_DISK -11111
#define PROCPS_DISKSTATS_TYPE_PARTITION -22222
-#define PROCPS_DISKSTATS_GET( diskstats, actual_enum, type ) \
- procps_diskstats_get( diskstats, actual_enum ) -> result . type
+#define PROCPS_DISKSTATS_GET( info, actual_enum, type ) \
+ procps_diskstats_get( info, actual_enum ) -> result . type
#define PROCPS_DISKSTATS_VAL( relative_enum, type, stack) \
stack -> head [ relative_enum ] . result . type
-struct procps_diskstats;
+struct diskstats_info;
-int procps_diskstats_new (struct procps_diskstats **info);
-int procps_diskstats_ref (struct procps_diskstats *info);
-int procps_diskstats_unref (struct procps_diskstats **info);
+int procps_diskstats_new (struct diskstats_info **info);
+int procps_diskstats_ref (struct diskstats_info *info);
+int procps_diskstats_unref (struct diskstats_info **info);
struct diskstats_result *procps_diskstats_get (
- struct procps_diskstats *info,
+ struct diskstats_info *info,
const char *name,
enum diskstats_item item);
struct diskstats_reap *procps_diskstats_reap (
- struct procps_diskstats *info,
+ struct diskstats_info *info,
enum diskstats_item *items,
int numitems);
struct diskstats_stack *procps_diskstats_select (
- struct procps_diskstats *info,
+ struct diskstats_info *info,
const char *name,
enum diskstats_item *items,
int numitems);
struct diskstats_stack **procps_diskstats_sort (
- struct procps_diskstats *info,
+ struct diskstats_info *info,
struct diskstats_stack *stacks[],
int numstacked,
enum diskstats_item sortitem,
struct meminfo_stack **stacks;
};
-struct procps_meminfo {
+struct meminfo_info {
int refcount;
int meminfo_fd;
int meminfo_was_read;
static inline void cleanup_stacks_all (
- struct procps_meminfo *info)
+ struct meminfo_info *info)
{
struct stacks_extent *ext = info->extents;
int i;
static void extents_free_all (
- struct procps_meminfo *info)
+ struct meminfo_info *info)
{
while (info->extents) {
struct stacks_extent *p = info->extents;
static int make_hash_failed (
- struct procps_meminfo *info)
+ struct meminfo_info *info)
{
#define htVAL(f) e.key = STRINGIFY(f) ":"; e.data = &info->hist.new. f; \
if (!hsearch_r(e, ENTER, &ep, &info->hashtab)) return -errno;
* into the supplied info structure
*/
static int read_meminfo_failed (
- struct procps_meminfo *info)
+ struct meminfo_info *info)
{
/* a 'memory history reference' macro for readability,
so we can focus the field names ... */
* Returns a stacks_extent struct anchoring the 'heads' of each new stack.
*/
static struct stacks_extent *stacks_alloc (
- struct procps_meminfo *info,
+ struct meminfo_info *info,
int maxstacks)
{
struct stacks_extent *p_blob;
* a pointer to a new context struct
*/
PROCPS_EXPORT int procps_meminfo_new (
- struct procps_meminfo **info)
+ struct meminfo_info **info)
{
- struct procps_meminfo *p;
+ struct meminfo_info *p;
int rc;
if (info == NULL || *info != NULL)
return -EINVAL;
- if (!(p = calloc(1, sizeof(struct procps_meminfo))))
+ if (!(p = calloc(1, sizeof(struct meminfo_info))))
return -ENOMEM;
p->refcount = 1;
PROCPS_EXPORT int procps_meminfo_ref (
- struct procps_meminfo *info)
+ struct meminfo_info *info)
{
if (info == NULL)
return -EINVAL;
PROCPS_EXPORT int procps_meminfo_unref (
- struct procps_meminfo **info)
+ struct meminfo_info **info)
{
if (info == NULL || *info == NULL)
return -EINVAL;
// --- variable interface functions -------------------------------------------
PROCPS_EXPORT struct meminfo_result *procps_meminfo_get (
- struct procps_meminfo *info,
+ struct meminfo_info *info,
enum meminfo_item item)
{
static time_t sav_secs;
* Returns: pointer to a meminfo_stack struct on success, NULL on error.
*/
PROCPS_EXPORT struct meminfo_stack *procps_meminfo_select (
- struct procps_meminfo *info,
+ struct meminfo_info *info,
enum meminfo_item *items,
int numitems)
{
};
-#define PROCPS_MEMINFO_GET( meminfo, actual_enum, type ) \
- procps_meminfo_get( meminfo, actual_enum ) -> result . type
+#define PROCPS_MEMINFO_GET( info, actual_enum, type ) \
+ procps_meminfo_get( info, actual_enum ) -> result . type
#define PROCPS_MEMINFO_VAL( relative_enum, type, stack) \
stack -> head [ relative_enum ] . result . type
-struct procps_meminfo;
+struct meminfo_info;
-int procps_meminfo_new (struct procps_meminfo **info);
-int procps_meminfo_ref (struct procps_meminfo *info);
-int procps_meminfo_unref (struct procps_meminfo **info);
+int procps_meminfo_new (struct meminfo_info **info);
+int procps_meminfo_ref (struct meminfo_info *info);
+int procps_meminfo_unref (struct meminfo_info **info);
struct meminfo_result *procps_meminfo_get (
- struct procps_meminfo *info,
+ struct meminfo_info *info,
enum meminfo_item item);
struct meminfo_stack *procps_meminfo_select (
- struct procps_meminfo *info,
+ struct meminfo_info *info,
enum meminfo_item *items,
int numitems);
struct pids_counts counts; // actual counts pointed to by 'results'
};
-struct procps_pidsinfo {
+struct pids_info {
int refcount;
int maxitems; // includes 'logical_end' delimiter
int curitems; // includes 'logical_end' delimiter
#define setNAME(e) set_results_ ## e
#define setDECL(e) static void setNAME(e) \
- (struct procps_pidsinfo *I, struct pids_result *R, proc_t *P)
+ (struct pids_info *I, struct pids_result *R, proc_t *P)
/* convert pages to kib */
#define CVT_set(e,t,x) setDECL(e) { \
#define x_ouser PROC_FILLSTATUS | PROC_FILLUSR
#define x_supgrp PROC_FILLSTATUS | PROC_FILLSUPGRP
-typedef void (*SET_t)(struct procps_pidsinfo *, struct pids_result *, proc_t *);
+typedef void (*SET_t)(struct pids_info *, struct pids_result *, proc_t *);
typedef void (*FRE_t)(struct pids_result *);
typedef int (*QSR_t)(const void *, const void *, void *);
static void config_history (
- struct procps_pidsinfo *info)
+ struct pids_info *info)
{
int i;
static inline HST_t *histget (
- struct procps_pidsinfo *info,
+ struct pids_info *info,
int pid)
{
int V = Hr(PHash_sav[_HASH_PID_(pid)]);
static inline void histput (
- struct procps_pidsinfo *info,
+ struct pids_info *info,
unsigned this)
{
int V = _HASH_PID_(Hr(PHist_new[this].pid));
static int make_hist (
- struct procps_pidsinfo *info,
+ struct pids_info *info,
proc_t *p)
{
#define nSLOT info->hist->num_tasks
static inline void toggle_history (
- struct procps_pidsinfo *info)
+ struct pids_info *info)
{
void *v;
#ifdef UNREF_RPTHASH
static void unref_rpthash (
- struct procps_pidsinfo *info)
+ struct pids_info *info)
{
int i, j, pop, total_occupied, maxdepth, maxdepth_sav, numdepth
, cross_foot, sz = HHASH_SIZE * (int)sizeof(int)
// ___ Standard Private Functions |||||||||||||||||||||||||||||||||||||||||||||
static inline void assign_results (
- struct procps_pidsinfo *info,
+ struct pids_info *info,
struct pids_stack *stack,
proc_t *p)
{
static inline void cleanup_stacks_all (
- struct procps_pidsinfo *info)
+ struct pids_info *info)
{
struct stacks_extent *ext = info->extents;
int i;
* 'static' or 'invarient' results stacks. By unsplicing an extent
* from the info anchor it will be isolated from future reset/free. */
static struct stacks_extent *extent_cut (
- struct procps_pidsinfo *info,
+ struct pids_info *info,
struct stacks_extent *ext)
{
struct stacks_extent *p = info->extents;
static void extents_free_all (
- struct procps_pidsinfo *info)
+ struct pids_info *info)
{
while (info->extents) {
struct stacks_extent *p = info->extents;
static void itemize_stacks_all (
- struct procps_pidsinfo *info)
+ struct pids_info *info)
{
struct stacks_extent *ext = info->extents;
static inline void libflags_set (
- struct procps_pidsinfo *info)
+ struct pids_info *info)
{
enum pids_item e;
int i;
static inline int proc_tally (
- struct procps_pidsinfo *info,
+ struct pids_info *info,
struct pids_counts *counts,
proc_t *p)
{
* Returns an array of pointers representing the 'heads' of each new stack.
*/
static struct stacks_extent *stacks_alloc (
- struct procps_pidsinfo *info,
+ struct pids_info *info,
int maxstacks)
{
struct stacks_extent *p_blob;
static int stacks_fetch (
- struct procps_pidsinfo *info)
+ struct pids_info *info)
{
#define n_alloc info->fetch.n_alloc
#define n_inuse info->fetch.n_inuse
* a pointer to a new context struct
*/
PROCPS_EXPORT int procps_pids_new (
- struct procps_pidsinfo **info,
+ struct pids_info **info,
enum pids_item *items,
int numitems)
{
- struct procps_pidsinfo *p;
+ struct pids_info *p;
double uptime_secs;
int pgsz;
if (info == NULL || *info != NULL)
return -EINVAL;
- if (!(p = calloc(1, sizeof(struct procps_pidsinfo))))
+ if (!(p = calloc(1, sizeof(struct pids_info))))
return -ENOMEM;
/* if we're without items or numitems, a later call to
PROCPS_EXPORT int procps_pids_ref (
- struct procps_pidsinfo *info)
+ struct pids_info *info)
{
if (info == NULL)
return -EINVAL;
PROCPS_EXPORT int procps_pids_unref (
- struct procps_pidsinfo **info)
+ struct pids_info **info)
{
if (info == NULL || *info == NULL)
return -EINVAL;
// --- variable interface functions -------------------------------------------
PROCPS_EXPORT struct pids_stack *fatal_proc_unmounted (
- struct procps_pidsinfo *info,
+ struct pids_info *info,
int return_self)
{
static proc_t self;
struct stacks_extent *ext;
/* this is very likely the *only* newlib function where the
- context (procps_pidsinfo) of NULL will ever be permitted */
+ context (pids_info) of NULL will ever be permitted */
look_up_our_self(&self);
if (!return_self)
return NULL;
PROCPS_EXPORT struct pids_stack *procps_pids_get (
- struct procps_pidsinfo *info,
+ struct pids_info *info,
enum pids_fetch_type which)
{
static proc_t task; // static for initial zeroes + later dynamic free(s)
* Returns: pointer to a pids_fetch struct on success, NULL on error.
*/
PROCPS_EXPORT struct pids_fetch *procps_pids_reap (
- struct procps_pidsinfo *info,
+ struct pids_info *info,
enum pids_fetch_type which)
{
int rc;
PROCPS_EXPORT int procps_pids_reset (
- struct procps_pidsinfo *info,
+ struct pids_info *info,
enum pids_item *newitems,
int newnumitems)
{
* Returns: pointer to a pids_fetch struct on success, NULL on error.
*/
PROCPS_EXPORT struct pids_fetch *procps_pids_select (
- struct procps_pidsinfo *info,
+ struct pids_info *info,
unsigned *these,
int numthese,
enum pids_select_type which)
* Note: all of the stacks must be homogeneous (of equal length and content).
*/
PROCPS_EXPORT struct pids_stack **procps_pids_sort (
- struct procps_pidsinfo *info,
+ struct pids_info *info,
struct pids_stack *stacks[],
int numstacked,
enum pids_item sortitem,
stack -> head [ relative_enum ] . result . type
-struct procps_pidsinfo;
+struct pids_info;
-int procps_pids_new (struct procps_pidsinfo **info, enum pids_item *items, int numitems);
-int procps_pids_ref (struct procps_pidsinfo *info);
-int procps_pids_unref (struct procps_pidsinfo **info);
+int procps_pids_new (struct pids_info **info, enum pids_item *items, int numitems);
+int procps_pids_ref (struct pids_info *info);
+int procps_pids_unref (struct pids_info **info);
struct pids_stack *fatal_proc_unmounted (
- struct procps_pidsinfo *info,
+ struct pids_info *info,
int return_self);
struct pids_stack *procps_pids_get (
- struct procps_pidsinfo *info,
+ struct pids_info *info,
enum pids_fetch_type which);
struct pids_fetch *procps_pids_reap (
- struct procps_pidsinfo *info,
+ struct pids_info *info,
enum pids_fetch_type which);
int procps_pids_reset (
- struct procps_pidsinfo *info,
+ struct pids_info *info,
enum pids_item *newitems,
int newnumitems);
struct pids_fetch *procps_pids_select (
- struct procps_pidsinfo *info,
+ struct pids_info *info,
unsigned *these,
int numthese,
enum pids_select_type which);
struct pids_stack **procps_pids_sort (
- struct procps_pidsinfo *info,
+ struct pids_info *info,
struct pids_stack *stacks[],
int numstacked,
enum pids_item sortitem,
struct slabinfo_reap results; // count + stacks for return to caller
};
-struct procps_slabinfo {
+struct slabinfo_info {
int refcount;
FILE *slabinfo_fp;
int slabinfo_was_read;
/* Alloc up more slabnode memory, if required
*/
static int alloc_slabnodes (
- struct procps_slabinfo *info)
+ struct slabinfo_info *info)
{
struct slabs_node *new_nodes;
int new_count;
* constant.
*/
static int get_slabnode (
- struct procps_slabinfo *info,
+ struct slabinfo_info *info,
struct slabs_node **node)
{
int retval;
* : cpustat <allochit> <allocmiss> <freehit> <freemiss>
*/
static int parse_slabinfo20 (
- struct procps_slabinfo *info)
+ struct slabinfo_info *info)
{
struct slabs_node *node;
char buffer[SLABINFO_LINE_LEN];
* Returns: 0 on success, negative on error
*/
static int read_slabinfo_failed (
- struct procps_slabinfo *info)
+ struct slabinfo_info *info)
{
char line[SLABINFO_LINE_LEN];
int retval, major, minor;
static int stacks_fetch (
- struct procps_slabinfo *info)
+ struct slabinfo_info *info)
{
#define n_alloc info->fetch.n_alloc
#define n_inuse info->fetch.n_inuse
* a pointer to a new context struct
*/
PROCPS_EXPORT int procps_slabinfo_new (
- struct procps_slabinfo **info)
+ struct slabinfo_info **info)
{
- struct procps_slabinfo *p;
+ struct slabinfo_info *p;
int rc;
if (info == NULL)
return -EINVAL;
- if (!(p = calloc(1, sizeof(struct procps_slabinfo))))
+ if (!(p = calloc(1, sizeof(struct slabinfo_info))))
return -ENOMEM;
#ifdef ENFORCE_LOGICAL
PROCPS_EXPORT int procps_slabinfo_ref (
- struct procps_slabinfo *info)
+ struct slabinfo_info *info)
{
if (info == NULL)
return -EINVAL;
PROCPS_EXPORT int procps_slabinfo_unref (
- struct procps_slabinfo **info)
+ struct slabinfo_info **info)
{
if (info == NULL || *info == NULL)
return -EINVAL;
// --- variable interface functions -------------------------------------------
PROCPS_EXPORT struct slabinfo_result *procps_slabinfo_get (
- struct procps_slabinfo *info,
+ struct slabinfo_info *info,
enum slabinfo_item item)
{
static time_t sav_secs;
* Returns: pointer to a slabinfo_reap struct on success, NULL on error.
*/
PROCPS_EXPORT struct slabinfo_reap *procps_slabinfo_reap (
- struct procps_slabinfo *info,
+ struct slabinfo_info *info,
enum slabinfo_item *items,
int numitems)
{
* Returns: pointer to a slabinfo_stack struct on success, NULL on error.
*/
PROCPS_EXPORT struct slabinfo_stack *procps_slabinfo_select (
- struct procps_slabinfo *info,
+ struct slabinfo_info *info,
enum slabinfo_item *items,
int numitems)
{
* Note: all of the stacks must be homogeneous (of equal length and content).
*/
PROCPS_EXPORT struct slabinfo_stack **procps_slabinfo_sort (
- struct procps_slabinfo *info,
+ struct slabinfo_info *info,
struct slabinfo_stack *stacks[],
int numstacked,
enum slabinfo_item sortitem,
};
-#define PROCPS_SLABINFO_GET( slabinfo, actual_enum, type ) \
- procps_slabinfo_get( slabinfo, actual_enum ) -> result . type
+#define PROCPS_SLABINFO_GET( info, actual_enum, type ) \
+ procps_slabinfo_get( info, actual_enum ) -> result . type
#define PROCPS_SLABINFO_VAL( relative_enum, type, stack ) \
stack -> head [ relative_enum ] . result . type
-struct procps_slabinfo;
+struct slabinfo_info;
-int procps_slabinfo_new (struct procps_slabinfo **info);
-int procps_slabinfo_ref (struct procps_slabinfo *info);
-int procps_slabinfo_unref (struct procps_slabinfo **info);
+int procps_slabinfo_new (struct slabinfo_info **info);
+int procps_slabinfo_ref (struct slabinfo_info *info);
+int procps_slabinfo_unref (struct slabinfo_info **info);
struct slabinfo_result *procps_slabinfo_get (
- struct procps_slabinfo *info,
+ struct slabinfo_info *info,
enum slabinfo_item item);
struct slabinfo_reap *procps_slabinfo_reap (
- struct procps_slabinfo *info,
+ struct slabinfo_info *info,
enum slabinfo_item *items,
int numitems);
struct slabinfo_stack *procps_slabinfo_select (
- struct procps_slabinfo *info,
+ struct slabinfo_info *info,
enum slabinfo_item *items,
int numitems);
struct slabinfo_stack **procps_slabinfo_sort (
- struct procps_slabinfo *info,
+ struct slabinfo_info *info,
struct slabinfo_stack *stacks[],
int numstacked,
enum slabinfo_item sortitem,
struct stat_reap result; // summary + stacks returned to caller
};
-struct procps_statinfo {
+struct stat_info {
int refcount;
int stat_fd;
int stat_was_read; // is stat file history valid?
static int make_numa_hist (
- struct procps_statinfo *info)
+ struct stat_info *info)
{
#ifndef NUMA_DISABLE
struct hist_tic *cpu_ptr, *nod_ptr;
static int read_stat_failed (
- struct procps_statinfo *info)
+ struct stat_info *info)
{
struct hist_tic *sum_ptr, *cpu_ptr;
char buf[8192], *bp, *b;
static int stacks_fetch_tics (
- struct procps_statinfo *info,
+ struct stat_info *info,
struct reap_support *this)
{
#define n_alloc this->n_alloc
static struct stat_stack *update_single_stack (
- struct procps_statinfo *info,
+ struct stat_info *info,
struct ext_support *this)
{
if (!this->extents
* a pointer to a new context struct
*/
PROCPS_EXPORT int procps_stat_new (
- struct procps_statinfo **info)
+ struct stat_info **info)
{
- struct procps_statinfo *p;
+ struct stat_info *p;
if (info == NULL || *info != NULL)
return -EINVAL;
- if (!(p = calloc(1, sizeof(struct procps_statinfo))))
+ if (!(p = calloc(1, sizeof(struct stat_info))))
return -ENOMEM;
p->refcount = 1;
PROCPS_EXPORT int procps_stat_ref (
- struct procps_statinfo *info)
+ struct stat_info *info)
{
if (info == NULL)
return -EINVAL;
PROCPS_EXPORT int procps_stat_unref (
- struct procps_statinfo **info)
+ struct stat_info **info)
{
if (info == NULL || *info == NULL)
return -EINVAL;
// --- variable interface functions -------------------------------------------
PROCPS_EXPORT struct stat_result *procps_stat_get (
- struct procps_statinfo *info,
+ struct stat_info *info,
enum stat_item item)
{
static time_t sav_secs;
* Returns: pointer to a stat_reaped struct on success, NULL on error.
*/
PROCPS_EXPORT struct stat_reaped *procps_stat_reap (
- struct procps_statinfo *info,
+ struct stat_info *info,
enum stat_reap_type what,
enum stat_item *items,
int numitems)
* Returns: pointer to a stat_stack struct on success, NULL on error.
*/
PROCPS_EXPORT struct stat_stack *procps_stat_select (
- struct procps_statinfo *info,
+ struct stat_info *info,
enum stat_item *items,
int numitems)
{
#define PROCPS_STAT_SUMMARY_ID -11111
#define PROCPS_STAT_NODE_INVALID -22222
-#define PROCPS_STAT_GET( statinfo, actual_enum, type ) \
- procps_stat_get( statinfo, actual_enum ) -> result . type
+#define PROCPS_STAT_GET( info, actual_enum, type ) \
+ procps_stat_get( info, actual_enum ) -> result . type
#define PROCPS_STAT_VAL( relative_enum, type, stack ) \
stack -> head [ relative_enum ] . result . type
-struct procps_statinfo;
+struct stat_info;
-int procps_stat_new (struct procps_statinfo **info);
-int procps_stat_ref (struct procps_statinfo *info);
-int procps_stat_unref (struct procps_statinfo **info);
+int procps_stat_new (struct stat_info **info);
+int procps_stat_ref (struct stat_info *info);
+int procps_stat_unref (struct stat_info **info);
struct stat_result *procps_stat_get (
- struct procps_statinfo *info,
+ struct stat_info *info,
enum stat_item item);
struct stat_reaped *procps_stat_reap (
- struct procps_statinfo *info,
+ struct stat_info *info,
enum stat_reap_type what,
enum stat_item *items,
int numitems);
struct stat_stack *procps_stat_select (
- struct procps_statinfo *info,
+ struct stat_info *info,
enum stat_item *items,
int numitems);
struct vmstat_stack **stacks;
};
-struct procps_vmstat {
+struct vmstat_info {
int refcount;
int vmstat_fd;
int vmstat_was_read;
static inline void cleanup_stacks_all (
- struct procps_vmstat *info)
+ struct vmstat_info *info)
{
struct stacks_extent *ext = info->extents;
int i;
static void extents_free_all (
- struct procps_vmstat *info)
+ struct vmstat_info *info)
{
while (info->extents) {
struct stacks_extent *p = info->extents;
static int make_hash_failed (
- struct procps_vmstat *info)
+ struct vmstat_info *info)
{
#define htVAL(f) e.key = STRINGIFY(f); e.data = &info->hist.new. f; \
if (!hsearch_r(e, ENTER, &ep, &info->hashtab)) return -errno;
* into the supplied info structure
*/
static int read_vmstat_failed (
- struct procps_vmstat *info)
+ struct vmstat_info *info)
{
char buf[8192];
char *head, *tail;
* Returns a stacks_extent struct anchoring the 'heads' of each new stack.
*/
static struct stacks_extent *stacks_alloc (
- struct procps_vmstat *info,
+ struct vmstat_info *info,
int maxstacks)
{
struct stacks_extent *p_blob;
* a pointer to a new context struct
*/
PROCPS_EXPORT int procps_vmstat_new (
- struct procps_vmstat **info)
+ struct vmstat_info **info)
{
- struct procps_vmstat *p;
+ struct vmstat_info *p;
int rc;
if (info == NULL || *info != NULL)
return -EINVAL;
- if (!(p = calloc(1, sizeof(struct procps_vmstat))))
+ if (!(p = calloc(1, sizeof(struct vmstat_info))))
return -ENOMEM;
p->refcount = 1;
PROCPS_EXPORT int procps_vmstat_ref (
- struct procps_vmstat *info)
+ struct vmstat_info *info)
{
if (info == NULL)
return -EINVAL;
PROCPS_EXPORT int procps_vmstat_unref (
- struct procps_vmstat **info)
+ struct vmstat_info **info)
{
if (info == NULL || *info == NULL)
return -EINVAL;
// --- variable interface functions -------------------------------------------
PROCPS_EXPORT struct vmstat_result *procps_vmstat_get (
- struct procps_vmstat *info,
+ struct vmstat_info *info,
enum vmstat_item item)
{
static time_t sav_secs;
* Returns: pointer to a vmstat_stack struct on success, NULL on error.
*/
PROCPS_EXPORT struct vmstat_stack *procps_vmstat_select (
- struct procps_vmstat *info,
+ struct vmstat_info *info,
enum vmstat_item *items,
int numitems)
{
};
-#define PROCPS_VMSTAT_GET( vmstat, actual_enum, type ) \
- procps_vmstat_get( vmstat, actual_enum ) -> result . type
+#define PROCPS_VMSTAT_GET( info, actual_enum, type ) \
+ procps_vmstat_get( info, actual_enum ) -> result . type
#define PROCPS_VMSTAT_VAL( relative_enum, type, stack ) \
stack -> head [ relative_enum ] . result . type
-struct procps_vmstat;
+struct vmstat_info;
-int procps_vmstat_new (struct procps_vmstat **info);
-int procps_vmstat_ref (struct procps_vmstat *info);
-int procps_vmstat_unref (struct procps_vmstat **info);
+int procps_vmstat_new (struct vmstat_info **info);
+int procps_vmstat_ref (struct vmstat_info *info);
+int procps_vmstat_unref (struct vmstat_info **info);
struct vmstat_result *procps_vmstat_get (
- struct procps_vmstat *info,
+ struct vmstat_info *info,
enum vmstat_item item);
struct vmstat_stack *procps_vmstat_select (
- struct procps_vmstat *info,
+ struct vmstat_info *info,
enum vmstat_item *items,
int numitems);