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

  1. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!mips!swrinde!elroy.jpl.nasa.gov!ames!ncar!destroyer!sol.ctr.columbia.edu!The-Star.honeywell.com!umn.edu!math.fu-berlin.de!unidui!flyer!easix!umunk!udo
  2. From: udo@umunk.GUN.de (Udo Munk)
  3. Newsgroups: comp.unix.questions
  4. Subject: Re: reliable write()
  5. Message-ID: <9208141294@umunk.GUN.de>
  6. Date: 14 Aug 92 20:04:33 GMT
  7. References: <14001@auspex-gw.auspex.com>
  8. Organization: umunk (private)
  9. Lines: 29
  10. X-Newsreader: Tin 1.1 PL4
  11.  
  12. guy@Auspex.COM (Guy Harris) writes:
  13. : >Once in the
  14. : >kernel, however, you have no way of knowing when the write to disk
  15. : >will occur.
  16. : True by default, but *some* flavors of UNIX, as noted, have one of two
  17. : mechanisms to give greater control over when the write to disk will
  18. : occur:
  19. :     1) O_SYNC - a file descriptor mode bit that can be set when the
  20. :        file is opened (by including O_SYNC in the open mode) or
  21. :        after it's opened (with "fcntl()"); if set, all writes are
  22. :        supposed to go immediately to some flavor of permanent
  23. :        storage (e.g., disk).
  24. :     2) "fsync()" - a call that can be performed on a file descriptor
  25. :        to flush all file data to permanent storage.
  26. : Some flavors of UNIX have O_SYNC, some have "fsync()", some have both,
  27. : some have neither.
  28.  
  29. What about calling system("sync"); after a flush of the buffers for
  30. systems which have neighter?
  31. --
  32. Udo Munk     | voice:      +49 2131 275348             | uucp: +49 2131 278869
  33. Oberstr. 21  | mail :      udo@umunk.GUN.de            |     2400/1200/300 8N1
  34. 4040 Neuss 1 | ...!{mcshh,smurf,unido}!easix!umunk!udo | MYNAME=bbsuser
  35. Fed. Rep. of | CompuServe: 100021,2515                 | login: uucp
  36. Germany      | at first connect get ~/info  and ~/files| pwd:   public
  37.