OT: multi-platform *nix blocksize detection

ryanx at indy.rr.com ryanx at indy.rr.com
Wed Oct 20 08:09:57 PDT 2004


On Tue, Oct 19, 2004 at 11:15:37PM -0400, Fairlight said:

> Anyone know how to standardly detect the block size on a *nix filesystem,
> independant of platform type?

The only standard method I know of is compiling for each platform. The
file system structs vary.

You could use "ls -ls" to get the number of blocks allocated for a few
files of specific sizes. From this you should be able to determine if
its 512 or 1024 bytes. Set POSIXLY_CORRECT to force ls to report the
allocation in 512 byte chunks.

-- 
Ryan
-------------------------------------------------------------------------------


More information about the Filepro-list mailing list