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

  1. Path: sparky!uunet!mcsun!ieunet!!bsullivn
  2. From: bsullivn@sc.sni.ie (Bryan O'Sullivan)
  3. Newsgroups: comp.unix.programmer
  4. Subject: Re: close(hFile) -- Does it write data to disk?
  5. Message-ID: <165@sc.sni.ie>
  6. Date: 18 Aug 92 17:06:47 GMT
  7. Article-I.D.: sc.165
  8. References: <1992Aug13.203508.12617@ns.network.com>
  9. Reply-To: bryan@sc.sni.ie
  10. Organization: Siemens-Nixdorf Software Development Centre, Dublin
  11. Lines: 22
  12. X-Newsreader: Tin 1.1 PL3
  13.  
  14.  
  15.  
  16. dmb@eddore.network.com (Duane M. Butler) writes:
  17.  
  18. : I have ported an application from DOS to SunOS 4.1.  The application manages
  19. : some database files and uses a transaction tracking file to protect the
  20. : database integrity in the event of failure (ie., power outage).  For every
  21. : database write operation an entry is added to the transaction file.  For this
  22. : to work properly, the transaction file must be flushed to disk after every
  23. : write.  I'm currently using the close() system call followed by open() to
  24. : flush the file.  Can I safely rely on close() to write data to disk, or is
  25. : there some other mechanism?
  26.  
  27. Close(2) is not guaranteed to flush a file, nor is a later open(2) going
  28. to help.  Use the fsync(2) system call; it takes a file descriptor as
  29. its argument.
  30.  
  31.     -- Bryan
  32.  
  33. -- 
  34. Bryan O'Sullivan                                             +353-1-767551 x225
  35. Siemens-Nixdorf Informationssysteme AG                          bryan@sc.sni.ie
  36. Software Development Centre                    "Theory like mist on eyeglasses.
  37. Dublin                                          Obscure facts." -- Charlie Chan
  38.