[mod_backhand-devel] available memory for FreeBSD

"Petr Holub" <[email protected]> Tue, 6 Jan 2004 17:03:53 +0100
Newsgroups gmane.comp.apache.mod-backhand.devel
Message-ID <018701c3d46e$ae96df00$2603fb93@kloboucek>
Hi all,

I would suggest a small correction for computing available memory
on FreeBSD:

--- platform.c.old      Sat Aug 24 22:16:03 2002
+++ platform.c  Tue Jan  6 17:00:31 2004
@@ -589,8 +589,7 @@
 #endif
   len = sizeof(struct vmtotal);
   sysctl(mib, 2, &ourmem, &len, NULL, 0);
-  ourmem.t_free /= 1024*1024; /* calculate in mb */
-  ss->amem=(int)usermem-(ourpagesize*ourmem.t_free);
+  ss->amem=(int)ourpagesize*ourmem.t_free/(1024*1024);
   ss->cpu =(int)ourcpu;
   ss->ncpu=(int)ncpu;
   /* Fill out hostname */


Could somebody verify that it's OK?

Thanks,
Petr