[comp.unix.wizards] holes in files

david@bacchus.esa.oz.au (David Burren) (01/30/91)

Where can I find mention of the implementation of "holes" in files under
the BSD ffs or other filesystems?
Do I guess and assume that the relevant block pointer(s) have some
sentinel value (eg. 0) to flag the fact that there is no data?
It seems the logical explanation, but I'm surprised I haven't found it
mentioned (or am I blind?).

I've read McKusick, et. al, "A Fast File System for UNIX" and Leffler, et. al.
"The Design and Implementation of the 4.3BSD UNIX Operating System", but
have found nary a mention of holes.

One of the excercises at the end of the filesystem chapter in Leffler et. al.
mentions them, but that's the only lead.

I'd appreciate any pointers towards a definite answer on this.

BTW, under some OSes I've seen processes with sparse address maps produce
core dumps with holes in them.  I once had a user ask me "how can I make my
file a core file?"  He was a student trying to get around quotas....
_____________________________________________________________________________
David Burren [Athos]                          Email: david@bacchus.esa.oz.au
Software Development Engineer                 Phone: +61 3 819 4554
Expert Solutions Australia, Hawthorn, VIC     Fax:   +61 3 819 5580

david@bacchus.esa.oz.au (David Burren) (01/31/91)

In article <1111@bacchus.esa.oz.au>, david@bacchus.esa.oz.au (David Burren) writes:
> Where can I find mention of the implementation of "holes" in files under
> the BSD ffs or other filesystems?
> Do I guess and assume that the relevant block pointer(s) have some
> sentinel value (eg. 0) to flag the fact that there is no data?

Thank you all who have responded.  Apparently that is how it's done.
One respondent noted that block 0 on the disks he'd looked at were
zeroed out and that that's why reading a hole returned zeros, but those
must have been non-boot disks that for some reason had block 0 cleared.
I was under the impression that it wasn't used on non-boot volumes.

Anyway, I'm told that the fs code interprets the 0 pointer as being to an
unallocated block no matter what the values in block 0 are.

Thanks folks, I don't think I need any more email on the subject....


> BTW, under some OSes I've seen processes with sparse address maps produce
> core dumps with holes in them.  I once had a user ask me "how can I make my
> file a core file?"  He was a student trying to get around quotas....

Yes folks, that time it was a SunOS 4.x machine.  Is anyone aware of other
flavours of Unix/etc that regularly exhibit the same behaviour?

- David B.