cvs commit: src/sys/ufs/ufs ufs_vnops.c

Bruce Evans bde at zeta.org.au
Thu Jun 1 13:59:49 UTC 2006


On Thu, 1 Jun 2006, Scott Long wrote:

> Maxim Konovalov wrote:
>
>> maxim       2006-05-31 13:15:29 UTC
>> 
>>   FreeBSD src repository
>> 
>>   Modified files:
>>     sys/ufs/ufs          ufs_vnops.c   Log:
>>   o According to POSIX, the result of ftruncate(2) is unspecified
>>   for file types other than VREG, VDIR and shared memory objects.
>>   We already handle VREG, VLNK and VDIR cases.  Silently ignore
>>   truncate requests for all the rest.  Adjust comments.
> ...
> If POSIX says that the result is undefined, wouldn't it be in our
> best interests to return EBADF instead of 0?  Or would that break
> 3rd party software?

POSIX says that the result is unspecified, not that it is undefined.

truncate.2 has many bugs, but null changes to it are required to be
(almost) consistent with this commit.  This commit just makes the code
agree with the documentation in one case.  truncate.2 never documented
that [f]truncate() panics on fifos.  It tries to say that [f]truncate()
always succeeds on fifos, but gets this wrong for truncate() on fifos
(and device files...) residing on r/o file systems (unless we interpret
fifos as not residing on file systems at all).  It doesn't document
that file systems cloned from ffs still panic for [f]truncate() on
fifos, or the details of the panics; nor should it.

See another reply for more details.

Bruce


More information about the cvs-src mailing list