delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/10/22/15:01:20

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: fstream and fflush
Date: 22 Oct 2004 18:46:09 GMT
Lines: 22
Message-ID: <2tt2rhF22u71pU1@uni-berlin.de>
References: <cl92jr$3ro$1 AT coranto DOT ucs DOT mun DOT ca> <cl96k3$45r$1 AT coranto DOT ucs DOT mun DOT ca> <2tqpgmF245sdvU4 AT uni-berlin DOT de> <clanbn$8j1$1 AT coranto DOT ucs DOT mun DOT ca>
X-Trace: news.uni-berlin.de y1zsOWsnigEd1IlPoYxD3wSGdqoIryyuZHIGWS64epDpdc1neBYqLErOOC
X-Orig-Path: not-for-mail
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Jason Mills <jmills AT cs DOT mun DOT ca> wrote:
> Hans-Bernhard Broeker wrote:

[...]
> for example.
> 2. Perhaps unwisely, I was using stat() to query the file size
> periodically in order to rotate the log file based on file size.

Well, fstat() would probably have been wiser in this case.  But the
main problem is that your program, as you write elsewhere, assumes the
operating to be Unix, whereas you're actually on DOS.  DJGPP does try
rather hard to make DOS look and behave very much like Unix, but there
is a limit to that, and stat() and simultaneous access to the same
file by two independent system calls is about where that limit is.

In actuality, fsync() would really have been recommendable on Linux,
too, for this task --- that you didn't seem to need it was more by
luck than by design.

-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019