How can a file be truncated on System V??

Brandon S. Allbery allbery at ncoast.ORG
Sun May 7 02:49:54 AEST 1989


As quoted from <13619 at ncoast.ORG> by allbery at ncoast.ORG (Brandon S. Allbery):
+---------------
| Standard System V (except perhaps 3.2) doesn't have this.  Xenix System V
| may use one of two methods:
+---------------

I forgot to mention that different versions of Xenix use one or the other,
never both.  The zero-length write trick is pretty much obsolete.

+---------------
| (1) zero-length write at point of truncation
| (2) a system call whose name I've forgotten which truncates the file at
|     the current lseek() position
+---------------

I remembered it:  chsize(fd).  It will also "grow" the file if you've
lseek()'ed past EOF.  (I don't know whether it uses "holes" where possible
or always allocates disk space.)

++Brandon
-- 
Brandon S. Allbery, moderator of comp.sources.misc	     allbery at ncoast.org
uunet!hal.cwru.edu!ncoast!allbery		    ncoast!allbery at hal.cwru.edu
      Send comp.sources.misc submissions to comp-sources-misc@<backbone>
NCoast Public Access UN*X - (216) 781-6201, 300/1200/2400 baud, login: makeuser



More information about the Comp.unix.wizards mailing list