Mailing List Archive

available memory for FreeBSD
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
available memory for FreeBSD [ In reply to ]
Message got lost for a while... Looks good. comitted.

On Tue, 2004-01-06 at 11:03, Petr Holub wrote:
> 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
>
> _______________________________________________
> backhand-devel mailing list
> backhand-devel@lists.backhand.org
> http://lists.backhand.org/mailman/listinfo/backhand-devel
--
// Theo Schlossnagle
// Principal Engineer -- http://www.omniti.com/~jesus/
// Postal Engine -- http://www.postalengine.com/
// Ecelerity: fastest MTA on earth