home *** CD-ROM | disk | FTP | other *** search
- From: aakash@hpcupt3.cup.hp.com (Aakash Sahai)
- Date: Tue, 11 Aug 1992 21:11:02 GMT
- Subject: Re: reliable write()
- Message-ID: <118390006@hpcupt3.cup.hp.com>
- Organization: Hewlett Packard, Cupertino
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!mips!sdd.hp.com!hpscdc!hplextra!hpcc05!hpcuhb!hpcupt3!aakash
- Newsgroups: comp.unix.questions
- References: <ceVTJry00WB8I6kVVD@andrew.cmu.edu>
- Lines: 29
-
- > jdr+@andrew.cmu.edu (Jeff Rosenfeld) writes:
- >
- > Is there a standard way to get the Unix filesystem to write a file in such
- > a way that I can be assured that the data has made it to the disk?
- >
-
- The most standard way to do this is to use O_SYNC flag while opening the file
- to write. This forces the kernel to do a wait on the buffer till the I/O is
- done (i.e. till the time the disk driver marks the buffer as DONE and wakes up
- the sleeping process). However, if the disk driver or the disk hardware is
- doing some kind of buffering then you can never be sure if the data was written
- to media or not.
-
- > mjn@pseudo.uucp (Murray Nesbitt) writes
- >
- > You are probably aware of the fflush() system call, which will flush
- > data buffered in user address space into the kernel. Once in the
- > kernel, however, you have no way of knowing when the write to disk
- > will occur.
- >
- > Sorry.
-
- Sorry, there is no system call called "fflush()", maybe you are referring to
- the library call. You are right though, it does not guarantee that the data
- will be written to the disk.
-
- - Aakash
-
- S.D.A.
-