site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On Dec 2, 2006, at 12:02 PM, darwin-dev-request@lists.apple.com wrote: On Dec 1, 2006, at 2:37 PM, jmzorko@mac.com wrote: How do I determine the amount of free disk on a volume on OSX 10.4.x? The *nix statfs() API seems limited to 32bit file lengths, unless i'm misunderstanding something. Can someone send me a quick example of how to do this?
From xnu/bsd/vfs/vfs_syscalls.c:munge_statfs(): This fixup is applied both for statfs(2) and getfsstat(2). = Mike
Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... The important detail you're missing here is that statfs(2) will lie about the block size in order to make the answer fit in 31 bits. /* * It's possible for there to be more than 2^^31 blocks in the filesystem, so we * have to fudge the numbers here in that case. We inflate the blocksize in order * to reflect the filesystem size as best we can. */ ... /* * Work out how far we have to shift the block count down to make it fit. * Note that it's possible to have to shift so far that the resulting * blocksize would be unreportably large. At that point, we will clip * any values that don't fit. * * For safety's sake, we also ensure that f_iosize is never reported as * being smaller than f_bsize. */ This email sent to site_archiver@lists.apple.com