Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!mcnc!ece-csc!ncrcae!sauron!wescott From: wescott@sauron.UUCP Newsgroups: comp.unix.wizards Subject: Re: BSD to SysV Message-ID: <942@sauron.Columbia.NCR.COM> Date: Wed, 28-Oct-87 18:19:26 EST Article-I.D.: sauron.942 Posted: Wed Oct 28 18:19:26 1987 Date-Received: Sat, 31-Oct-87 11:04:44 EST References: <9940@brl-adm.ARPA> <31892@sun.uucp> <1596@u1100a.UUCP> Reply-To: wescott@sauron.Columbia.NCR.COM (Mike Wescott) Organization: Entry Level Systems Development, NCR Corp., Columbia, SC Lines: 20 In article <1596@u1100a.UUCP> dbg@u1100a.UUCP (D B Grooms) writes: >> Has anyone figured out how to perform the BSD functions ``fsync()'' >> and ``ftruncate()'' in System V? >>>... making a copy of the file up to the new length, doing a "creat" or >>>"open" with O_TRUNC to truncate the original file to zero length, and then >>>copying the truncated copy on top of the original file. > For efficiency, it would be better to "mv" the original file to one with a > new name, "creat" the original file, and copy the desired size from the > newly named file to the original. This involves only one copy operation > instead of two. This does not take care of links and is not a general solution. Any other name for the original file remains linked to the original inode and is not truncated. -- -Mike Wescott wescott@ncrcae.Columbia.NCR.COM