How to sync a file on FreeBSD? [SOLVED]
unga888 at yahoo.com
Fri Jul 22 13:16:33 UTC 2011
--- On Fri, 7/22/11, Pieter de Goeje <pieter at degoeje.nl> wrote:
> From: Pieter de Goeje <pieter at degoeje.nl>
> Subject: Re: How to sync a file on FreeBSD?
> To: freebsd-questions at freebsd.org
> Cc: "Unga" <unga888 at yahoo.com>
> Date: Friday, July 22, 2011, 7:37 PM
> On Friday, July 22, 2011 08:44:00 AM
> Unga wrote:
> > How to sync a file on FreeBSD (esp. on 8.1) to disk?
> > I used fsync(2), but does not immediately flush to
> > I want my writing to a file (a log file) immediately
> available to other
> > users to read.
> A file doesn't need to be "synced" to disk for other users
> to read the latest
> data. The application just needs to call write(2) and the
> data is available.
> It will be written to and read from the operating system's
> file cache. If
> you're using stdio you can force a write(2) by calling
> - Pieter
Thanks for the replies.
fflush(3) after fputs seems to work.
More information about the freebsd-questions