Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!gorodish!guy From: guy%gorodish@Sun.COM (Guy Harris) Newsgroups: comp.unix.wizards Subject: Re: BSD to SysV Message-ID: <31892@sun.uucp> Date: Fri, 23-Oct-87 21:28:21 EST Article-I.D.: sun.31892 Posted: Fri Oct 23 21:28:21 1987 Date-Received: Sun, 25-Oct-87 18:44:07 EST References: <9940@brl-adm.ARPA> Sender: news@sun.uucp Lines: 14 > Has anyone figured out how to perform the BSD functions ``fsync()'' > and ``ftruncate()'' in System V? You can get the same general effect as "fsync" in some S5 implementations by using "fcntl" to turn the O_SYNC flag on for a file descriptor; this flag causes all writes to that descriptor to be done synchronously. 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. Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com