Re: statfs and 64bit file lengths?
Re: statfs and 64bit file lengths?
- Subject: Re: statfs and 64bit file lengths?
- From: Michael Smith <email@hidden>
- Date: Tue, 26 Dec 2006 13:24:55 -0800
On Dec 2, 2006, at 12:02 PM, email@hidden wrote:
On Dec 1, 2006, at 2:37 PM, email@hidden 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?
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.
From xnu/bsd/vfs/vfs_syscalls.c:munge_statfs():
/*
* 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 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 (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden