From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 26 20:49:53 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3B4C916A405 for ; Mon, 26 Feb 2007 20:49:53 +0000 (UTC) (envelope-from freebsd-hackers@adam.gs) Received: from mail.adam.gs (mail.adam.gs [66.230.143.179]) by mx1.freebsd.org (Postfix) with ESMTP id 1722913C4A5 for ; Mon, 26 Feb 2007 20:49:48 +0000 (UTC) (envelope-from freebsd-hackers@adam.gs) Received: from mail.adam.gs (localhost [127.0.0.1]) by mail.adam.gs (Postfix) with ESMTP id 6554A3CAF0C for ; Mon, 26 Feb 2007 15:28:56 -0500 (EST) DomainKey-Signature: a=rsa-sha1; q=dns; c=simple; s=mail; d=adam.gs; b=rCsbl9spQGquCydkEqPdCPeo+U9rj9157mGwitew8VUNr/rWhWiC0+gCMoiAZm4LLkGhc1q2gfWCPNZu5y8m5Y0SrEskA8I3krCp2vzeWhDCkqBSsQUXWPFh7aOvvZ8yCvv95LIGeakhf2iBBcRtGGtkTfCnrAaxK5zcwUJ3kRA=; Mime-Version: 1.0 (Apple Message framework v752.3) References: <45E33802.2020606@zend.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <4D3F70BA-53C3-4A22-99F4-728592F2DB84@adam.gs> Content-Transfer-Encoding: 7bit From: Adam Jacob Muller Date: Mon, 26 Feb 2007 15:28:54 -0500 To: freebsd-hackers@freebsd.org X-Mailer: Apple Mail (2.752.3) X-Authentication: 6Ivyy2jfvsXDoBb26DrfeBZ8GzGpqjqZzV+Sir7PeENp3QfLO5zmSGprrI8LUoyeAwIvaZXnIGD5REH0ZV1pbW2JbpzZLEyp4GQcIFX20C3n45CrsvY7Xxf+w+vhn7lCyk76VGvsOoqbYxCx+GKrqg== Subject: FreeBSD available disk space X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Feb 2007 20:49:53 -0000 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 . > 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