| 1 |
|
/* |
| 2 |
|
* i-scream central monitoring system |
| 3 |
+ |
* http://www.i-scream.org.uk |
| 4 |
|
* Copyright (C) 2000-2002 i-scream |
| 5 |
|
* |
| 6 |
|
* This program is free software; you can redistribute it and/or |
| 34 |
|
#include "ukcprog.h" |
| 35 |
|
|
| 36 |
|
char *get_memory_stats(){ |
| 37 |
< |
long total=0; |
| 38 |
< |
long free=0; |
| 39 |
< |
long used=0; |
| 40 |
< |
long cache=0; |
| 37 |
> |
long long total=0; |
| 38 |
> |
long long free=0; |
| 39 |
> |
long long used=0; |
| 40 |
> |
long long cache=0; |
| 41 |
|
char *xml_memory_stats; |
| 42 |
|
#ifdef LINUX |
| 43 |
|
FILE *f; |
| 44 |
|
char *line; |
| 45 |
< |
long buffers; |
| 45 |
> |
long long buffers; |
| 46 |
|
#endif |
| 47 |
|
#ifdef SOLARIS |
| 48 |
|
kstat_ctl_t *kc; |
| 68 |
|
} |
| 69 |
|
while((line=fpgetline(f)) != NULL){ |
| 70 |
|
if (((strncmp(line,"Mem:",4)) == 0)) { |
| 71 |
< |
if((sscanf(line, "%*s %ld %ld %ld %*s %ld %ld", &total, &used, &free, &buffers, &cache)) != 5){ |
| 71 |
> |
if((sscanf(line, "%*s %lld %lld %lld %*s %lld %lld", &total, &used, &free, &buffers, &cache)) != 5){ |
| 72 |
|
errf("Failed to read memory details (%m)"); |
| 73 |
|
return NULL; |
| 74 |
|
} |