library: tweak formatting style for meminfo and vmstat
This patch mostly just eliminates darn tab characters. Plus the library function declarations and definitions have been standardized. Most visibly, the input params now have all been indented on their own separate line. Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
7a7cf686ec
commit
500a901475
@ -26,6 +26,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include <proc/meminfo.h>
|
#include <proc/meminfo.h>
|
||||||
#include "procps-private.h"
|
#include "procps-private.h"
|
||||||
|
|
||||||
@ -67,7 +68,8 @@ struct procps_meminfo {
|
|||||||
*
|
*
|
||||||
* Returns: a new meminfo info container
|
* Returns: a new meminfo info container
|
||||||
*/
|
*/
|
||||||
PROCPS_EXPORT int procps_meminfo_new(struct procps_meminfo **info)
|
PROCPS_EXPORT int procps_meminfo_new (
|
||||||
|
struct procps_meminfo **info)
|
||||||
{
|
{
|
||||||
struct procps_meminfo *m;
|
struct procps_meminfo *m;
|
||||||
m = calloc(1, sizeof(struct procps_meminfo));
|
m = calloc(1, sizeof(struct procps_meminfo));
|
||||||
@ -86,7 +88,8 @@ PROCPS_EXPORT int procps_meminfo_new(struct procps_meminfo **info)
|
|||||||
* Read the data out of /proc/meminfo putting the information
|
* Read the data out of /proc/meminfo putting the information
|
||||||
* into the supplied info structure
|
* into the supplied info structure
|
||||||
*/
|
*/
|
||||||
PROCPS_EXPORT int procps_meminfo_read(struct procps_meminfo *info)
|
PROCPS_EXPORT int procps_meminfo_read (
|
||||||
|
struct procps_meminfo *info)
|
||||||
{
|
{
|
||||||
char buf[8192];
|
char buf[8192];
|
||||||
char *head, *tail;
|
char *head, *tail;
|
||||||
@ -161,7 +164,8 @@ PROCPS_EXPORT int procps_meminfo_read(struct procps_meminfo *info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PROCPS_EXPORT struct procps_meminfo *procps_meminfo_ref(struct procps_meminfo *info)
|
PROCPS_EXPORT struct procps_meminfo *procps_meminfo_ref (
|
||||||
|
struct procps_meminfo *info)
|
||||||
{
|
{
|
||||||
if (info == NULL)
|
if (info == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -169,7 +173,8 @@ PROCPS_EXPORT struct procps_meminfo *procps_meminfo_ref(struct procps_meminfo *i
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
PROCPS_EXPORT struct procps_meminfo *procps_meminfo_unref(struct procps_meminfo *info)
|
PROCPS_EXPORT struct procps_meminfo *procps_meminfo_unref (
|
||||||
|
struct procps_meminfo *info)
|
||||||
{
|
{
|
||||||
if (info == NULL)
|
if (info == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -181,11 +186,11 @@ PROCPS_EXPORT struct procps_meminfo *procps_meminfo_unref(struct procps_meminfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Accessor functions */
|
/* Accessor functions */
|
||||||
PROCPS_EXPORT unsigned long procps_meminfo_get(
|
PROCPS_EXPORT unsigned long procps_meminfo_get (
|
||||||
struct procps_meminfo *info,
|
struct procps_meminfo *info,
|
||||||
enum meminfo_item item)
|
enum meminfo_item item)
|
||||||
{
|
{
|
||||||
switch(item) {
|
switch (item) {
|
||||||
case PROCPS_MEM_ACTIVE:
|
case PROCPS_MEM_ACTIVE:
|
||||||
return info->data.active;
|
return info->data.active;
|
||||||
case PROCPS_MEM_INACTIVE:
|
case PROCPS_MEM_INACTIVE:
|
||||||
|
@ -26,33 +26,36 @@
|
|||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
struct procps_meminfo;
|
|
||||||
int procps_meminfo_new(struct procps_meminfo **info);
|
|
||||||
int procps_meminfo_read(struct procps_meminfo *info);
|
|
||||||
struct procps_meminfo *procps_meminfo_ref(struct procps_meminfo *info);
|
|
||||||
struct procps_meminfo *procps_meminfo_unref(struct procps_meminfo *info);
|
|
||||||
|
|
||||||
enum meminfo_item {
|
enum meminfo_item {
|
||||||
PROCPS_MEM_ACTIVE,
|
|
||||||
PROCPS_MEM_INACTIVE,
|
|
||||||
PROCPS_MEMHI_FREE,
|
PROCPS_MEMHI_FREE,
|
||||||
PROCPS_MEMHI_TOTAL,
|
PROCPS_MEMHI_TOTAL,
|
||||||
PROCPS_MEMHI_USED,
|
PROCPS_MEMHI_USED,
|
||||||
PROCPS_MEMLO_FREE,
|
PROCPS_MEMLO_FREE,
|
||||||
PROCPS_MEMLO_TOTAL,
|
PROCPS_MEMLO_TOTAL,
|
||||||
PROCPS_MEMLO_USED,
|
PROCPS_MEMLO_USED,
|
||||||
|
PROCPS_MEM_ACTIVE,
|
||||||
PROCPS_MEM_AVAILABLE,
|
PROCPS_MEM_AVAILABLE,
|
||||||
PROCPS_MEM_BUFFERS,
|
PROCPS_MEM_BUFFERS,
|
||||||
PROCPS_MEM_CACHED,
|
PROCPS_MEM_CACHED,
|
||||||
PROCPS_MEM_FREE,
|
PROCPS_MEM_FREE,
|
||||||
|
PROCPS_MEM_INACTIVE,
|
||||||
PROCPS_MEM_SHARED,
|
PROCPS_MEM_SHARED,
|
||||||
PROCPS_MEM_TOTAL,
|
PROCPS_MEM_TOTAL,
|
||||||
PROCPS_MEM_USED,
|
PROCPS_MEM_USED,
|
||||||
PROCPS_SWAP_FREE,
|
PROCPS_SWAP_FREE,
|
||||||
PROCPS_SWAP_TOTAL,
|
PROCPS_SWAP_TOTAL,
|
||||||
PROCPS_SWAP_USED,
|
PROCPS_SWAP_USED
|
||||||
};
|
};
|
||||||
unsigned long procps_meminfo_get(struct procps_meminfo *info, enum meminfo_item item);
|
|
||||||
|
struct procps_meminfo;
|
||||||
|
|
||||||
|
int procps_meminfo_new (struct procps_meminfo **info);
|
||||||
|
int procps_meminfo_read (struct procps_meminfo *info);
|
||||||
|
|
||||||
|
struct procps_meminfo *procps_meminfo_ref (struct procps_meminfo *info);
|
||||||
|
struct procps_meminfo *procps_meminfo_unref (struct procps_meminfo *info);
|
||||||
|
|
||||||
|
unsigned long procps_meminfo_get (struct procps_meminfo *info, enum meminfo_item item);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
#endif
|
#endif
|
||||||
|
@ -41,7 +41,8 @@ struct procps_vmstat {
|
|||||||
*
|
*
|
||||||
* Returns: a new procps_vmstat container
|
* Returns: a new procps_vmstat container
|
||||||
*/
|
*/
|
||||||
PROCPS_EXPORT int procps_vmstat_new(struct procps_vmstat **info)
|
PROCPS_EXPORT int procps_vmstat_new (
|
||||||
|
struct procps_vmstat **info)
|
||||||
{
|
{
|
||||||
struct procps_vmstat *v;
|
struct procps_vmstat *v;
|
||||||
v = calloc(1, sizeof(struct procps_vmstat));
|
v = calloc(1, sizeof(struct procps_vmstat));
|
||||||
@ -62,7 +63,8 @@ PROCPS_EXPORT int procps_vmstat_new(struct procps_vmstat **info)
|
|||||||
*
|
*
|
||||||
* Returns: 0 on success, negative on error
|
* Returns: 0 on success, negative on error
|
||||||
*/
|
*/
|
||||||
PROCPS_EXPORT int procps_vmstat_read(struct procps_vmstat *info)
|
PROCPS_EXPORT int procps_vmstat_read (
|
||||||
|
struct procps_vmstat *info)
|
||||||
{
|
{
|
||||||
char buf[8192];
|
char buf[8192];
|
||||||
char *head, *tail;
|
char *head, *tail;
|
||||||
@ -116,7 +118,8 @@ PROCPS_EXPORT int procps_vmstat_read(struct procps_vmstat *info)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
PROCPS_EXPORT struct procps_vmstat *procps_vmstat_ref(struct procps_vmstat *info)
|
PROCPS_EXPORT struct procps_vmstat *procps_vmstat_ref (
|
||||||
|
struct procps_vmstat *info)
|
||||||
{
|
{
|
||||||
if (info == NULL)
|
if (info == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -124,7 +127,8 @@ PROCPS_EXPORT struct procps_vmstat *procps_vmstat_ref(struct procps_vmstat *info
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
PROCPS_EXPORT struct procps_vmstat *procps_vmstat_unref(struct procps_vmstat *info)
|
PROCPS_EXPORT struct procps_vmstat *procps_vmstat_unref (
|
||||||
|
struct procps_vmstat *info)
|
||||||
{
|
{
|
||||||
if (info == NULL)
|
if (info == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -136,11 +140,11 @@ PROCPS_EXPORT struct procps_vmstat *procps_vmstat_unref(struct procps_vmstat *in
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Accessor functions */
|
/* Accessor functions */
|
||||||
PROCPS_EXPORT unsigned long procps_vmstat_get(
|
PROCPS_EXPORT unsigned long procps_vmstat_get (
|
||||||
struct procps_vmstat *info,
|
struct procps_vmstat *info,
|
||||||
enum vmstat_item item)
|
enum vmstat_item item)
|
||||||
{
|
{
|
||||||
switch(item) {
|
switch (item) {
|
||||||
case PROCPS_VMSTAT_PGPGIN:
|
case PROCPS_VMSTAT_PGPGIN:
|
||||||
return info->data.pgpgin;
|
return info->data.pgpgin;
|
||||||
case PROCPS_VMSTAT_PGPGOUT:
|
case PROCPS_VMSTAT_PGPGOUT:
|
||||||
|
@ -27,19 +27,22 @@
|
|||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
struct procps_vmstat;
|
|
||||||
int procps_vmstat_new(struct procps_vmstat **info);
|
|
||||||
int procps_vmstat_read(struct procps_vmstat *info);
|
|
||||||
struct procps_vmstat *procps_vmstat_ref(struct procps_vmstat *info);
|
|
||||||
struct procps_vmstat *procps_vmstat_unref(struct procps_vmstat *info);
|
|
||||||
|
|
||||||
enum vmstat_item {
|
enum vmstat_item {
|
||||||
PROCPS_VMSTAT_PGPGIN,
|
PROCPS_VMSTAT_PGPGIN,
|
||||||
PROCPS_VMSTAT_PGPGOUT,
|
PROCPS_VMSTAT_PGPGOUT,
|
||||||
PROCPS_VMSTAT_PSWPIN,
|
PROCPS_VMSTAT_PSWPIN,
|
||||||
PROCPS_VMSTAT_PSWPOUT
|
PROCPS_VMSTAT_PSWPOUT
|
||||||
};
|
};
|
||||||
unsigned long procps_vmstat_get(struct procps_vmstat *info, enum vmstat_item item);
|
|
||||||
|
struct procps_vmstat;
|
||||||
|
|
||||||
|
int procps_vmstat_new (struct procps_vmstat **info);
|
||||||
|
int procps_vmstat_read (struct procps_vmstat *info);
|
||||||
|
|
||||||
|
struct procps_vmstat *procps_vmstat_ref (struct procps_vmstat *info);
|
||||||
|
struct procps_vmstat *procps_vmstat_unref (struct procps_vmstat *info);
|
||||||
|
|
||||||
|
unsigned long procps_vmstat_get (struct procps_vmstat *info, enum vmstat_item item);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user