Thanks in advance,
Rui Maciel
> Is it possible to check the file size limit of a file system that is
> being used in a partition? If it's possible then how is it done?
You can get an upper and lower bound for the limit by using
pathconf() with _PC_FILESIZEBITS. This returns the "minimum number of
bits needed to represent, as a signed integer value, the maximum size
of a regular file allowed in the specified directory".
For example, if pathconf() returns 32 then you know the maximum file
size is between 2^30 and 2^31-1 (inclusive).
If you need a more accurate answer, and:
* you can write to a file on the file system,
* sizeof(off_t)*8 in your process is not less than the value returned
by pathconf(),
* your process's file size limit is large enough (or you can set it
large enough with setrlimit(), and
* the file system supports sparse files,
then you can do a binary search between the upper and lower bounds
using either truncate() or a combination of lseek() and write().
--
Geoff Clare <net...@gclare.org.uk>
> Rui Maciel wrote:
>
> > Is it possible to check the file size limit of a file system that is
> > being used in a partition? If it's possible then how is it done?
>
> You can get an upper and lower bound for the limit by using pathconf()
> with _PC_FILESIZEBITS. This returns the "minimum number of bits needed
> to represent, as a signed integer value, the maximum size of a regular
> file allowed in the specified directory".
On a system with the GNU libc binaries, the ‘getconf(1)’ program can
help if you want to test this out from the command line:
$ getconf FILESIZEBITS /tmp
64
--
\ “Creativity can be a social contribution, but only in so far as |
`\ society is free to use the results.” —Richard Stallman |
_o__) |
Ben Finney