I'm looking for a generic way to find the size of a block special. To determine the size of a regular file, we use stat() or fstat(). But how does one determine the size of a partition? Both stat() and fstat() return zero length (Solaris says the st_blocks field is indeterminate) for a block special file.
I did find code in the Util-Linux package that does it, but it is clearly specific to Linux. Do y'all know of a general Unix way of determining the size of a special file? (Linux utils use BLKGETSIZE which is defined in kernel headers, notably linux/fs.h and sys/mount.h.) Thanks. -- R;
