| 11 |
|
#include <sys/sysctl.h> |
| 12 |
|
#include <unistd.h> |
| 13 |
|
#endif |
| 14 |
< |
#include <ukcprog.h> |
| 14 |
> |
#include "ukcprog.h" |
| 15 |
|
|
| 16 |
|
char *get_memory_stats(){ |
| 17 |
|
long total=0; |
| 95 |
|
errf("Failed to get free memory (%m)"); |
| 96 |
|
return NULL; |
| 97 |
|
} |
| 98 |
+ |
if((kstat_close(kc)) != 0){ |
| 99 |
+ |
errf("Failed to close kstat control structure (%m)"); |
| 100 |
+ |
return NULL; |
| 101 |
+ |
} |
| 102 |
|
total=((totalmem*pagesize)/1024)/1024; |
| 103 |
|
free=(((kn->value.ul)*pagesize)/1024)/1024; |
| 104 |
|
used=total-free; |
| 160 |
|
return NULL; |
| 161 |
|
} |
| 162 |
|
return xml_memory_stats; |
| 159 |
– |
} |
| 160 |
– |
|
| 161 |
– |
int main(){ |
| 162 |
– |
printf("%s\n", get_memory_stats()); |
| 163 |
– |
exit(0); |
| 163 |
|
} |