ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/ihost/libstatgrab/memory_stats.c
(Generate patch)

Comparing projects/cms/source/ihost/libstatgrab/memory_stats.c (file contents):
Revision 1.8 by tdb, Tue May 21 16:47:12 2002 UTC vs.
Revision 1.10 by tdb, Wed May 29 19:41:59 2002 UTC

# Line 18 | Line 18
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>
# Line 81 | Line 85 | char *get_memory_stats(){
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){
# Line 174 | Line 178 | char *get_memory_stats(){
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          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines