[PATCH] free: format output as byte, KB, MB or GB

Denys Vlasenko vda.linux at googlemail.com
Sat Oct 2 10:57:50 UTC 2010


On Saturday 02 October 2010 00:40, Stefan Tomanek wrote:
> OK, I pulled *mem_unit into the format macro to avoid the overflow; now the
> memory values get shifted first, which will hopefully avoid the overflow.

Now they will underflow. Try shifting 500000 right by 20 bits and then
multiplying by 1024. The result is 0. Thus, free -m will show 500
megabytes as 0. Not good.

Please try latest git, I committed a sligtly changed version which should work.
Let me know if it does not.
-- 
vda


More information about the busybox mailing list