Re: [BUG] fallocate behavior when crossing end-of-file

Edward Shishkin
2009-05-06T15:36:14Z

Michael Raskin wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Edward Shishkin wrote:
>
>>> Desired: something (probably, one block) is allocated/reserved for the
>>> file. File length is set to 1 byte.
>>>
>>
>> Where is it documented?
>>
>> IMHO we should only guarantee that writes
>> to [0, 1] won't fail because of lack of disk space.
>> Other things (including file size) are up to implementation.
>>
>
> POSIX, SUS.
>
> http://www.opengroup.org/onlinepubs/009695399/functions/posix_fallocate.html
>
> <<<
> If the offset+ len is beyond the current file size, then
> posix_fallocate() shall adjust the file size to offset+ len. Otherwise,
> the file size shall not be changed.
>

fallocate (2) is something different from posix_fallocate:

"...This default behavior closely resembles the behavior
of the posix_fallocate(3) library function, and is intended
as a method of optimally implementing that function."