How can a file be truncated on System V??

Brandon S. Allbery allbery at ncoast.ORG
Sun May 7 02:43:07 AEST 1989


As quoted from <887 at twwells.uucp> by bill at twwells.uucp (T. William Wells):
+---------------
| In article <651 at mitisft.Convergent.COM> kemnitz at mitisft.Convergent.COM (Gregory Kemnitz) writes:
| : There is an ULTRIX (I think) function
| :
| : ftruncate(fd, length)
| : int fd, length;
| 
| (Actually, BSD)
| 
| You don't do it with a standard system call. I once had occasion to
| look long and hard for this and didn't find it.
+---------------

Standard System V (except perhaps 3.2) doesn't have this.  Xenix System V
may use one of two methods:

(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

SysV 3.2 probably uses the latter method.  I can look up the syscall if
you're desperate.

++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