[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::digital_unix

Title:DIGITAL UNIX(FORMERLY KNOWN AS DEC OSF/1)
Notice:Welcome to the Digital UNIX Conference
Moderator:SMURF::DENHAM
Created:Thu Mar 16 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:10068
Total number of notes:35879

9720.0. "fsync with fopen" by CADSYS::BOGDANOV () Mon May 05 1997 17:46

Hi,
	I tried fsync on a file opened by fopen for write: fsync(fileno(f)). It
seems that it does not update disk storage (at least over nfs). Is it an
expected behavior on V4.0 386 (no idea what letter is assigned to this version)?
The nfs-mounted disk is served by a 3.2D machine.

	I have had no problem since i updated my stuff to use of file
descriptors (creat). I just want to find out what was happening. (In any case,
sync() works as expected.)

	Any comment?

>> Serge
T.RTitleUserPersonal
Name
DateLines
9720.1SSDEVO::ROLLOWDr. File System's Home for Wayward Inodes.Tue May 06 1997 05:006
	Things which write file pointers, write their data to a buffer
	managed by the stdio library.  When the buffer is full, a
	write(2) system is call is made.  Fsync has no knowledge of
	the stdio buffer, only the state of the buffer cache.  You
	want to do an fflush() first to force the data to the cache,
	and then use fsync to flush to disk.
9720.2Oops.CADSYS::BOGDANOVTue May 06 1997 09:564
Thanks.
	It hit me this morning that I forgot to flush the buffer.

>> Serge