Date: Mon, 26 Feb 2007 15:28:54 -0500 From: Adam Jacob Muller <freebsd-hackers@adam.gs> To: freebsd-hackers@freebsd.org Subject: FreeBSD available disk space Message-ID: <4D3F70BA-53C3-4A22-99F4-728592F2DB84@adam.gs> References: <45E33802.2020606@zend.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hello, I've been going back and forth for a bit trying to figure out this situation, and I am hoping that someone on this list will have some insight :) When using php's disk_free_space() function to determine the amount of free space on a partition that has a negative amount of free space, PHP returns an unreasonably large number, for example: >> [root@cube]# php -r 'var_dump(disk_free_space("/some/partition/ >> with/negative/free/space"));' >> float(3.7778931863E+22) this is the comment from one of the PHP developers who has been helping me to debug this issue: > Well, this is actually quite interesting. > The problem is that according to POSIX statvfs struct's field > f_bavail must be <unsigned long>. > But FreeBSD stores negative values in this field and I don't see > any hint on how to detect if this is a negative value or just a > huge positive one. > I can of course cast it to signed long, but that would effectively > break it on other platforms, which do conform POSIX standard and do > not store negative values in unsigned variables. > > I guess FreeBSD developers might help here, since that should be a > known problem for them. as well as: > I can see that libstatgrab uses #ifdef's for all *BSD flavours and > casts f_bavail to (long long). > Not sure if this is the correct solution, my previous suspicions > that it may not work with really big filesystems still aply. Thanks in advance for any insight you may have! -Adam
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D3F70BA-53C3-4A22-99F4-728592F2DB84>