Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!hao!boulder!sunybcs!rutgers!bellcore!faline!sabre!gamma!pyuxp!u1100a!dbg From: dbg@u1100a.UUCP (D B Grooms) Newsgroups: comp.unix.wizards Subject: Re: BSD to SysV Message-ID: <1596@u1100a.UUCP> Date: Tue, 27-Oct-87 16:29:23 EST Article-I.D.: u1100a.1596 Posted: Tue Oct 27 16:29:23 1987 Date-Received: Fri, 30-Oct-87 05:20:48 EST References: <9940@brl-adm.ARPA> <31892@sun.uucp> Reply-To: dbg@u1100a.UUCP (D B Grooms) Organization: Bell Communications Research, Piscataway, NJ Lines: 22 > Has anyone figured out how to perform the BSD functions ``fsync()'' > and ``ftruncate()'' in System V? > >>... >> >>Unless you're truncating a file to zero length, you can't do "ftruncate()" >>except by 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. Dave Grooms Bell Communications Research {ihnp4,bellcore,pyuxww}!u1100a!dbg x x x x x