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