| 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 |
| 18 |
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 19 |
|
*/ |
| 20 |
|
|
| 21 |
+ |
#ifdef HAVE_CONFIG_H |
| 22 |
+ |
#include "config.h" |
| 23 |
+ |
#endif |
| 24 |
+ |
|
| 25 |
|
#include <stdio.h> |
| 26 |
|
#ifdef LINUX |
| 27 |
|
#include <string.h> |
| 85 |
|
} |
| 86 |
|
|
| 87 |
|
cache=cache+buffers; |
| 88 |
< |
used=total-(free+cache); |
| 88 |
> |
used=total-free; |
| 89 |
|
|
| 90 |
|
total=(total/1024)/1024; |
| 91 |
|
used=(used/1024)/1024; |
| 92 |
|
free=(free/1024)/1024; |
| 93 |
< |
cache=(free/1024)/1024; |
| 93 |
> |
cache=(cache/1024)/1024; |
| 94 |
|
#endif |
| 95 |
|
#ifdef SOLARIS |
| 96 |
|
if((pagesize=sysconf(_SC_PAGESIZE)) == -1){ |
| 178 |
|
|
| 179 |
|
#endif |
| 180 |
|
|
| 181 |
< |
|
| 182 |
< |
if((xml_memory_stats=strf("<memory><total>%ld</total><free>%ld</free><used>%ld</used><cache>%ld</cache></memory>", total, free, used, cache)) == NULL){ |
| 181 |
> |
/* casting these from a long long to a long is a KLUDGE! please fix it :) */ |
| 182 |
> |
if((xml_memory_stats=strf("<memory><total>%ld</total><free>%ld</free><used>%ld</used><cache>%ld</cache></memory>", (long)total, (long)free, (long)used, (long)cache)) == NULL){ |
| 183 |
|
errf("strf failed (%m)"); |
| 184 |
|
return NULL; |
| 185 |
|
} |