Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!brutus.cs.uiuc.edu!wuarchive!wugate!uunet!auspex!guy
From: guy@auspex.auspex.com (Guy Harris)
Newsgroups: comp.unix.questions
Subject: Re: ftruncate (was Set file size in SYSV)
Keywords: How
Message-ID: <2364@auspex.auspex.com>
Date: 16 Aug 89 18:10:07 GMT
References: <708@msa3b.UUCP> <18lG02Em4aQn01@amdahl.uts.amdahl.com>  <19088@mimsy.UUCP>
Reply-To: guy@auspex.auspex.com (Guy Harris)
Organization: Auspex Systems, Santa Clara
Lines: 17

>This is either a bug in the SunOS manpage (there are, it seems, many
>such) or---in this particular case, more likely---Yet Another Difference
>between SunOS and 4BSD.  Here the function is useful, but the name is
>bad.

It is Yet Another Difference between SunOS 4.x and 4BSD.  The name is
unfortunate, but I guess they didn't feel like adding a new call.  S5R4
will do all the file size adjusting functions with F_FREESP, and said
call is ultimately intended to let you punch holes in files as well (the
name is still arguably unfortunate, for although the "truncate" and
"punch a hole" functions do free up disk blocks, the "extend" function,
while I think it may not consume disk blocks on file systems that
support "holes", does grow the file). 

I've never been wild about using "fcntl" for stuff like that anyway; you
can write wrappers to perform the different F_FREESP functions, if you
want, and give them better names....