Re: Import truncate(1) from FreeBSD

David Holland <[email protected]> Wed, 12 Nov 2025 08:50:30 +0000
Newsgroups gmane.os.netbsd.devel.userlevel
Message-ID <[email protected]>
On Wed, Nov 05, 2025 at 07:39:30PM +0100, Naveen Narayanan wrote:
 > +.Pp
 > +If a file is made smaller, its extra data is lost.
 > +If a file is made larger,
 > +it will be extended as if by writing bytes with the value zero.

More helpfully, I'd suggest taking the wording from ftruncate(2).

Except that ftruncate(2) should also be clearer about whether the
extra space added is allocated or a hole.

(The answer is fs-dependent, but it's normally a hole and in
particular it's allowed to be, which is why you have to do something
else if you want to make sure the blocks are filled in.)

-- 
David A. Holland
[email protected]