library: normalize the readstat context structure name
The new library meminfo & vmstat modules use structure names for their context which exactly mirror the names of the very /proc/ files whose particulars they yield. The one exception to this rule was the readstat module whose struct was named statinfo yet the file was stat. This commit simply renames that structure (only) so as to hopefully establish such a naming convention as our standard going forward. And, it's makes good symmetry. [ this module's name itself is just perfect as it is ] Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
faf6d4dc93
commit
e88b11f176
@ -27,7 +27,7 @@ struct procps_jiffs_private {
|
||||
// future additions go here, please
|
||||
};
|
||||
|
||||
struct procps_statinfo {
|
||||
struct procps_stat {
|
||||
int refcount;
|
||||
int stat_fd;
|
||||
struct stat_data data;
|
||||
@ -49,10 +49,10 @@ struct procps_statinfo {
|
||||
* Returns: a new stat info container
|
||||
*/
|
||||
PROCPS_EXPORT int procps_stat_new (
|
||||
struct procps_statinfo **info)
|
||||
struct procps_stat **info)
|
||||
{
|
||||
struct procps_statinfo *v;
|
||||
v = calloc(1, sizeof(struct procps_statinfo));
|
||||
struct procps_stat *v;
|
||||
v = calloc(1, sizeof(struct procps_stat));
|
||||
if (!v)
|
||||
return -ENOMEM;
|
||||
|
||||
@ -73,7 +73,7 @@ PROCPS_EXPORT int procps_stat_new (
|
||||
* If CPU stats only needed, set cpu_only to non-zero
|
||||
*/
|
||||
PROCPS_EXPORT int procps_stat_read (
|
||||
struct procps_statinfo *info,
|
||||
struct procps_stat *info,
|
||||
const int cpu_only)
|
||||
{
|
||||
char buf[8192];
|
||||
@ -153,7 +153,7 @@ PROCPS_EXPORT int procps_stat_read (
|
||||
}
|
||||
|
||||
PROCPS_EXPORT int procps_stat_ref (
|
||||
struct procps_statinfo *info)
|
||||
struct procps_stat *info)
|
||||
{
|
||||
if (info == NULL)
|
||||
return -EINVAL;
|
||||
@ -162,7 +162,7 @@ PROCPS_EXPORT int procps_stat_ref (
|
||||
}
|
||||
|
||||
PROCPS_EXPORT int procps_stat_unref (
|
||||
struct procps_statinfo **info)
|
||||
struct procps_stat **info)
|
||||
{
|
||||
if (info == NULL || *info == NULL)
|
||||
return -EINVAL;
|
||||
@ -178,7 +178,7 @@ PROCPS_EXPORT int procps_stat_unref (
|
||||
}
|
||||
|
||||
PROCPS_EXPORT jiff procps_stat_get_cpu (
|
||||
struct procps_statinfo *info,
|
||||
struct procps_stat *info,
|
||||
enum procps_cpu_item item)
|
||||
{
|
||||
switch (item) {
|
||||
@ -207,7 +207,7 @@ PROCPS_EXPORT jiff procps_stat_get_cpu (
|
||||
}
|
||||
|
||||
PROCPS_EXPORT int procps_get_cpu_chain (
|
||||
struct procps_statinfo *info,
|
||||
struct procps_stat *info,
|
||||
struct procps_cpu_result *item)
|
||||
{
|
||||
if (item == NULL)
|
||||
@ -255,7 +255,7 @@ PROCPS_EXPORT int procps_get_cpu_chain (
|
||||
}
|
||||
|
||||
PROCPS_EXPORT unsigned int procps_stat_get_sys (
|
||||
struct procps_statinfo *info,
|
||||
struct procps_stat *info,
|
||||
enum procps_stat_item item)
|
||||
{
|
||||
switch (item) {
|
||||
@ -276,7 +276,7 @@ PROCPS_EXPORT unsigned int procps_stat_get_sys (
|
||||
}
|
||||
|
||||
PROCPS_EXPORT int procps_stat_get_sys_chain (
|
||||
struct procps_statinfo *info,
|
||||
struct procps_stat *info,
|
||||
struct procps_sys_result *item)
|
||||
{
|
||||
if (item == NULL)
|
||||
@ -324,7 +324,7 @@ PROCPS_EXPORT int procps_stat_get_sys_chain (
|
||||
* supplied structures upon request.
|
||||
*/
|
||||
PROCPS_EXPORT int procps_stat_read_jiffs (
|
||||
struct procps_statinfo *info)
|
||||
struct procps_stat *info)
|
||||
{
|
||||
#define ALLOCincr 32
|
||||
struct procps_jiffs_private *sum_ptr, *cpu_ptr;
|
||||
@ -413,7 +413,7 @@ reap_em_again:
|
||||
* This function deals only with the 'current' jiffs counts.
|
||||
*/
|
||||
PROCPS_EXPORT int procps_stat_get_jiffs (
|
||||
struct procps_statinfo *info,
|
||||
struct procps_stat *info,
|
||||
struct procps_jiffs *item,
|
||||
int which)
|
||||
{
|
||||
@ -451,7 +451,7 @@ PROCPS_EXPORT int procps_stat_get_jiffs (
|
||||
* This function deals only with the 'current' jiffs counts.
|
||||
*/
|
||||
PROCPS_EXPORT int procps_stat_get_jiffs_all (
|
||||
struct procps_statinfo *info,
|
||||
struct procps_stat *info,
|
||||
struct procps_jiffs *item,
|
||||
int numitems)
|
||||
{
|
||||
@ -477,7 +477,7 @@ PROCPS_EXPORT int procps_stat_get_jiffs_all (
|
||||
* This function provides both 'new' and 'old' jiffs counts.
|
||||
*/
|
||||
PROCPS_EXPORT int procps_stat_get_jiffs_hist (
|
||||
struct procps_statinfo *info,
|
||||
struct procps_stat *info,
|
||||
struct procps_jiffs_hist *item,
|
||||
int which)
|
||||
{
|
||||
@ -513,7 +513,7 @@ PROCPS_EXPORT int procps_stat_get_jiffs_hist (
|
||||
* This function provides both 'new' and 'old' jiffs counts.
|
||||
*/
|
||||
PROCPS_EXPORT int procps_stat_get_jiffs_hist_all (
|
||||
struct procps_statinfo *info,
|
||||
struct procps_stat *info,
|
||||
struct procps_jiffs_hist *item,
|
||||
int numitems)
|
||||
{
|
||||
|
@ -68,24 +68,24 @@ struct procps_sys_result {
|
||||
struct procps_sys_result *next;
|
||||
};
|
||||
|
||||
struct procps_statinfo;
|
||||
struct procps_stat;
|
||||
|
||||
int procps_stat_new (struct procps_statinfo **info);
|
||||
int procps_stat_read (struct procps_statinfo *info, const int cpu_only);
|
||||
int procps_stat_read_jiffs (struct procps_statinfo *info);
|
||||
int procps_stat_new (struct procps_stat **info);
|
||||
int procps_stat_read (struct procps_stat *info, const int cpu_only);
|
||||
int procps_stat_read_jiffs (struct procps_stat *info);
|
||||
|
||||
int procps_stat_ref (struct procps_statinfo *info);
|
||||
int procps_stat_unref (struct procps_statinfo **info);
|
||||
int procps_stat_ref (struct procps_stat *info);
|
||||
int procps_stat_unref (struct procps_stat **info);
|
||||
|
||||
jiff procps_stat_get_cpu (struct procps_statinfo *info, enum procps_cpu_item item);
|
||||
int procps_stat_get_cpu_chain (struct procps_statinfo *info, struct procps_cpu_result *item);
|
||||
int procps_stat_get_jiffs (struct procps_statinfo *info, struct procps_jiffs *item, int which);
|
||||
int procps_stat_get_jiffs_all (struct procps_statinfo *info, struct procps_jiffs *item, int numitems);
|
||||
int procps_stat_get_jiffs_hist (struct procps_statinfo *info, struct procps_jiffs_hist *item, int which);
|
||||
int procps_stat_get_jiffs_hist_all (struct procps_statinfo *info, struct procps_jiffs_hist *item, int numitems);
|
||||
jiff procps_stat_get_cpu (struct procps_stat *info, enum procps_cpu_item item);
|
||||
int procps_stat_get_cpu_chain (struct procps_stat *info, struct procps_cpu_result *item);
|
||||
int procps_stat_get_jiffs (struct procps_stat *info, struct procps_jiffs *item, int which);
|
||||
int procps_stat_get_jiffs_all (struct procps_stat *info, struct procps_jiffs *item, int numitems);
|
||||
int procps_stat_get_jiffs_hist (struct procps_stat *info, struct procps_jiffs_hist *item, int which);
|
||||
int procps_stat_get_jiffs_hist_all (struct procps_stat *info, struct procps_jiffs_hist *item, int numitems);
|
||||
|
||||
unsigned int procps_stat_get_sys (struct procps_statinfo *info, enum procps_stat_item item);
|
||||
int procps_stat_get_sys_chain (struct procps_statinfo *info, struct procps_sys_result *item);
|
||||
unsigned int procps_stat_get_sys (struct procps_stat *info, enum procps_stat_item item);
|
||||
int procps_stat_get_sys_chain (struct procps_stat *info, struct procps_sys_result *item);
|
||||
|
||||
__END_DECLS
|
||||
#endif
|
||||
|
@ -98,7 +98,7 @@ extern long Hertz;
|
||||
|
||||
static void get_boot_time(void)
|
||||
{
|
||||
struct procps_statinfo *sys_info;
|
||||
struct procps_stat *sys_info;
|
||||
if (procps_stat_new(&sys_info) < 0)
|
||||
xerrx(EXIT_FAILURE,
|
||||
_("Unable to create system stat structure"));
|
||||
|
@ -269,7 +269,7 @@ enum mem_enums {
|
||||
};
|
||||
#define MEM_VAL(e) mem_chain[e].result
|
||||
|
||||
static struct procps_statinfo *sys_info;
|
||||
static struct procps_stat *sys_info;
|
||||
static struct procps_jiffs_hist *Cpu_jiffs;
|
||||
|
||||
/*###### Sort callbacks ################################################*/
|
||||
|
6
vmstat.c
6
vmstat.c
@ -298,7 +298,7 @@ static void new_format(void)
|
||||
time_t the_time;
|
||||
char timebuf[32];
|
||||
struct procps_vmstat *vm_info;
|
||||
struct procps_statinfo *sys_info;
|
||||
struct procps_stat *sys_info;
|
||||
struct procps_meminfo *mem_info;
|
||||
|
||||
sleep_half = (sleep_time / 2);
|
||||
@ -837,7 +837,7 @@ static void disksum_format(void)
|
||||
|
||||
static void sum_format(void)
|
||||
{
|
||||
struct procps_statinfo *sys_info;
|
||||
struct procps_stat *sys_info;
|
||||
struct procps_vmstat *vm_info;
|
||||
struct procps_meminfo *mem_info;
|
||||
|
||||
@ -896,7 +896,7 @@ static void sum_format(void)
|
||||
|
||||
static void fork_format(void)
|
||||
{
|
||||
struct procps_statinfo *sys_info;
|
||||
struct procps_stat *sys_info;
|
||||
|
||||
if (procps_stat_new(&sys_info) < 0)
|
||||
xerrx(EXIT_FAILURE,
|
||||
|
Loading…
Reference in New Issue
Block a user