do not overflow type element
This commit is contained in:
@@ -4,22 +4,40 @@
|
|||||||
|
|
||||||
#include "shared/LL.h"
|
#include "shared/LL.h"
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
unsigned long total, user, system, nice, idle;
|
unsigned long total;
|
||||||
|
unsigned long user;
|
||||||
|
unsigned long system;
|
||||||
|
unsigned long nice;
|
||||||
|
unsigned long idle;
|
||||||
} load_type;
|
} load_type;
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
char dev[256], type[64], mpoint[256];
|
|
||||||
long bsize, blocks, bfree, files, ffree;
|
|
||||||
} mounts_type;
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int total, cache, buffers, free, shared;
|
char dev[256]; /*< device */
|
||||||
|
char type[64]; /*< file system type (as string) */
|
||||||
|
char mpoint[256]; /*< mount point */
|
||||||
|
long bsize; /*< transfer block size */
|
||||||
|
long blocks; /*< total data blocks in file system */
|
||||||
|
long bfree; /*< free blocks in fs */
|
||||||
|
long files; /*< total file nodes in file system */
|
||||||
|
long ffree; /*< free file nodes in fs */
|
||||||
|
} mounts_type;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int total;
|
||||||
|
int cache;
|
||||||
|
int buffers;
|
||||||
|
int free,;
|
||||||
|
int shared;
|
||||||
} meminfo_type;
|
} meminfo_type;
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char name[16];
|
char name[16];
|
||||||
@@ -27,6 +45,7 @@ typedef struct
|
|||||||
int number;
|
int number;
|
||||||
} procinfo_type;
|
} procinfo_type;
|
||||||
|
|
||||||
|
|
||||||
/* status definitions for network interfaces */
|
/* status definitions for network interfaces */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
down = 0,
|
down = 0,
|
||||||
@@ -61,6 +80,7 @@ typedef struct iface_info
|
|||||||
double tr_pkt_old;
|
double tr_pkt_old;
|
||||||
} IfaceInfo;
|
} IfaceInfo;
|
||||||
|
|
||||||
|
|
||||||
int machine_init();
|
int machine_init();
|
||||||
int machine_close();
|
int machine_close();
|
||||||
|
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ int machine_get_fs(mounts_type fs[], int *cnt)
|
|||||||
{
|
{
|
||||||
snprintf(fs[statcnt].dev, 255, "%s", pp->f_mntfromname);
|
snprintf(fs[statcnt].dev, 255, "%s", pp->f_mntfromname);
|
||||||
snprintf(fs[statcnt].mpoint, 255, "%s", pp->f_mntonname);
|
snprintf(fs[statcnt].mpoint, 255, "%s", pp->f_mntonname);
|
||||||
snprintf(fs[statcnt].type, 255, "%s", pp->f_fstypename);
|
snprintf(fs[statcnt].type, 63, "%s", pp->f_fstypename);
|
||||||
|
|
||||||
fs[statcnt].blocks = pp->f_blocks;
|
fs[statcnt].blocks = pp->f_blocks;
|
||||||
if (fs[statcnt].blocks > 0)
|
if (fs[statcnt].blocks > 0)
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ int machine_get_fs(mounts_type fs[], int *cnt)
|
|||||||
{
|
{
|
||||||
snprintf(fs[statcnt].dev, 255, "%s", pp->f_mntfromname);
|
snprintf(fs[statcnt].dev, 255, "%s", pp->f_mntfromname);
|
||||||
snprintf(fs[statcnt].mpoint, 255, "%s", pp->f_mntonname);
|
snprintf(fs[statcnt].mpoint, 255, "%s", pp->f_mntonname);
|
||||||
snprintf(fs[statcnt].type, 255, "%s", pp->f_fstypename);
|
snprintf(fs[statcnt].type, 63, "%s", pp->f_fstypename);
|
||||||
|
|
||||||
fs[statcnt].blocks = pp->f_blocks;
|
fs[statcnt].blocks = pp->f_blocks;
|
||||||
if (fs[statcnt].blocks > 0)
|
if (fs[statcnt].blocks > 0)
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ int machine_get_fs(mounts_type fs[], int *cnt)
|
|||||||
{
|
{
|
||||||
snprintf(fs[statcnt].dev, 255, "%s", pp->f_mntfromname);
|
snprintf(fs[statcnt].dev, 255, "%s", pp->f_mntfromname);
|
||||||
snprintf(fs[statcnt].mpoint, 255, "%s", pp->f_mntonname);
|
snprintf(fs[statcnt].mpoint, 255, "%s", pp->f_mntonname);
|
||||||
snprintf(fs[statcnt].type, 255, "%s", pp->f_fstypename);
|
snprintf(fs[statcnt].type, 63, "%s", pp->f_fstypename);
|
||||||
|
|
||||||
fs[statcnt].blocks = pp->f_blocks;
|
fs[statcnt].blocks = pp->f_blocks;
|
||||||
if (fs[statcnt].blocks > 0)
|
if (fs[statcnt].blocks > 0)
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ int machine_get_fs(mounts_type fs[], int *cnt)
|
|||||||
{
|
{
|
||||||
snprintf(fs[statcnt].dev, 255, "%s", pp->f_mntfromname);
|
snprintf(fs[statcnt].dev, 255, "%s", pp->f_mntfromname);
|
||||||
snprintf(fs[statcnt].mpoint, 255, "%s", pp->f_mntonname);
|
snprintf(fs[statcnt].mpoint, 255, "%s", pp->f_mntonname);
|
||||||
snprintf(fs[statcnt].type, 255, "%s", pp->f_fstypename);
|
snprintf(fs[statcnt].type, 63, "%s", pp->f_fstypename);
|
||||||
|
|
||||||
fs[statcnt].blocks = pp->f_blocks;
|
fs[statcnt].blocks = pp->f_blocks;
|
||||||
if (fs[statcnt].blocks > 0)
|
if (fs[statcnt].blocks > 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user