home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / question / 10014 < prev    next >
Encoding:
Internet Message Format  |  1992-08-12  |  1.4 KB

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