Releasing blocks from a file

John F. Haugh II jfh at rpp386.Dallas.TX.US
Sat May 20 10:15:33 AEST 1989


In article <461 at anvil.oz> michi at anvil.oz (Michael Henning) writes:
>4.3 BSD has a truncate() system call to get rid of trailing blocks at the end
>of a file. I believe that this was introduced to allow certain FORTRAN
>libraries to work under UNIX, which depended on that feature.
>I would like to know why this has not been generalised to allow
>*any* block of a file to be released. For example, in random access files
>such as B-trees, on deletion, one would like to get rid of a disk block.

I believe fclear() allows you to de-allocate blocks from random
locations within a file.  I think the syntax is like

	fclear (fd, whence, nbytes);

where fd is the open file descriptor, whence is the file offset and
nbytes is the number of bytes worth of hole to create.  This may be
wrong.  The manuals are at work.

This will not truncate the length of a file, as I recall.  However
ftruncate() is available for that situation.

Oh - I'm not an AIX developer.  I just play one on the net :-)  You
will want to read your manuals for more accurate information.
-- 
John F. Haugh II                        +-Button of the Week Club:-------------
VoiceNet: (512) 832-8832   Data: -8835  | "AIX is a three letter word,
InterNet: jfh at rpp386.Cactus.Org         |  and it's BLUE."
UucpNet : <backbone>!bigtex!rpp386!jfh  +--------------------------------------



More information about the Comp.unix.wizards mailing list