struct stacks_extent *extents;
struct hsearch_data hashtab;
struct meminfo_result get_this;
+ time_t sav_secs;
};
struct meminfo_info *info,
enum meminfo_item item)
{
- static __thread time_t sav_secs;
time_t cur_secs;
errno = EINVAL;
/* we will NOT read the meminfo file with every call - rather, we'll offer
a granularity of 1 second between reads ... */
cur_secs = time(NULL);
- if (1 <= cur_secs - sav_secs) {
+ if (1 <= cur_secs - info->sav_secs) {
if (meminfo_read_failed(info))
return NULL;
- sav_secs = cur_secs;
+ info->sav_secs = cur_secs;
}
info->get_this.item = item;
struct stacks_extent *get_ext; // for active 'get' (also within 'extents')
enum pids_fetch_type get_type; // last known type of 'get' request
int seterr; // an ENOMEM encountered during assign
+ proc_t get_proc; // the proc_t used by procps_pids_get
+ proc_t fetch_proc; // the proc_t used by pids_stacks_fetch
};
#define n_alloc info->fetch.n_alloc
#define n_inuse info->fetch.n_inuse
#define n_saved info->fetch.n_alloc_save
- static __thread proc_t task; // static for initial 0's + later free(s)
struct stacks_extent *ext;
// initialize stuff -----------------------------------
// iterate stuff --------------------------------------
n_inuse = 0;
- while (info->read_something(info->fetch_PT, &task)) {
+ while (info->read_something(info->fetch_PT, &info->fetch_proc)) {
if (!(n_inuse < n_alloc)) {
n_alloc += STACKS_GROW;
if (!(info->fetch.anchor = realloc(info->fetch.anchor, sizeof(void *) * n_alloc))
return -1; // here, errno was set to ENOMEM
memcpy(info->fetch.anchor + n_inuse, ext->stacks, sizeof(void *) * STACKS_GROW);
}
- if (!pids_proc_tally(info, &info->fetch.counts, &task))
+ if (!pids_proc_tally(info, &info->fetch.counts, &info->fetch_proc))
return -1; // here, errno was set to ENOMEM
- if (!pids_assign_results(info, info->fetch.anchor[n_inuse++], &task))
+ if (!pids_assign_results(info, info->fetch.anchor[n_inuse++], &info->fetch_proc))
return -1; // here, errno was set to ENOMEM
}
/* while the possibility is extremely remote, the readproc.c (read_something) |
struct pids_info *info,
enum pids_fetch_type which)
{
- static __thread proc_t task; // static for initial 0's + later free(s)
errno = EINVAL;
if (info == NULL)
}
errno = 0;
- if (NULL == info->read_something(info->get_PT, &task))
+ if (NULL == info->read_something(info->get_PT, &info->get_proc))
return NULL;
- if (!pids_assign_results(info, info->get_ext->stacks[0], &task))
+ if (!pids_assign_results(info, info->get_ext->stacks[0], &info->get_proc))
return NULL;
return info->get_ext->stacks[0];
} // end: procps_pids_get
struct fetch_support fetch; // support for procps_slabinfo_reap
struct slabs_node nul_node; // used by slabinfo_get/select
struct slabinfo_result get_this; // used by slabinfo_get
+ time_t sav_secs; // used by slabinfo_get
};
struct slabinfo_info *info,
enum slabinfo_item item)
{
- static __thread time_t sav_secs;
time_t cur_secs;
errno = EINVAL;
/* we will NOT read the slabinfo file with every call - rather, we'll offer
a granularity of 1 second between reads ... */
cur_secs = time(NULL);
- if (1 <= cur_secs - sav_secs) {
+ if (1 <= cur_secs - info->sav_secs) {
if (slabinfo_read_failed(info))
return NULL;
- sav_secs = cur_secs;
+ info->sav_secs = cur_secs;
}
info->get_this.item = item;
struct stat_result get_this; // for return to caller after a get
struct item_support reap_items; // items used for reap (shared among 3)
struct item_support select_items; // items unique to select
+ time_t sav_secs; // used by procps_stat_get to limit i/o
};
struct stat_info *info,
enum stat_item item)
{
- static __thread time_t sav_secs;
time_t cur_secs;
errno = EINVAL;
/* we will NOT read the source file with every call - rather, we'll offer
a granularity of 1 second between reads ... */
cur_secs = time(NULL);
- if (1 <= cur_secs - sav_secs) {
+ if (1 <= cur_secs - info->sav_secs) {
if (stat_read_failed(info))
return NULL;
- sav_secs = cur_secs;
+ info->sav_secs = cur_secs;
}
info->get_this.item = item;
struct stacks_extent *extents;
struct hsearch_data hashtab;
struct vmstat_result get_this;
+ time_t sav_secs;
};
struct vmstat_info *info,
enum vmstat_item item)
{
- static __thread time_t sav_secs;
time_t cur_secs;
errno = EINVAL;
/* we will NOT read the vmstat file with every call - rather, we'll offer
a granularity of 1 second between reads ... */
cur_secs = time(NULL);
- if (1 <= cur_secs - sav_secs) {
+ if (1 <= cur_secs - info->sav_secs) {
if (vmstat_read_failed(info))
return NULL;
- sav_secs = cur_secs;
+ info->sav_secs = cur_secs;
}
info->get_this.item = item;