Date: Fri, 22 Jul 2011 07:37:48 -0700 From: Michael Sierchio <kudzu@tenebras.com> To: Unga <unga888@yahoo.com> Cc: freebsd-questions@freebsd.org Subject: Re: How to sync a file on FreeBSD? [SOLVED] Message-ID: <CAHu1Y736ogt3Z-9v4xqaD4vLT7y1A%2BOsBicsaeb0mdi4M7XhVA@mail.gmail.com> In-Reply-To: <1311340592.24555.YahooMailClassic@web160109.mail.bf1.yahoo.com> References: <201107221337.15804.pieter@degoeje.nl> <1311340592.24555.YahooMailClassic@web160109.mail.bf1.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is extremely important, esp. with Softupdates, since fsync() does not guarantee a flush of all buffers to the medium. In order to implement a stable queue, it would be best to use a different filesystem. On Fri, Jul 22, 2011 at 6:16 AM, Unga <unga888@yahoo.com> wrote: > --- On Fri, 7/22/11, Pieter de Goeje <pieter@degoeje.nl> wrote: > >> From: Pieter de Goeje <pieter@degoeje.nl> >> Subject: Re: How to sync a file on FreeBSD? >> To: freebsd-questions@freebsd.org >> Cc: "Unga" <unga888@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 >> disk. >> > >> > 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 >> fflush(3). >> >> - Pieter >> > > Hi all > > Thanks for the replies. > > fflush(3) after fputs seems to work. > > Best regards > Unga > > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHu1Y736ogt3Z-9v4xqaD4vLT7y1A%2BOsBicsaeb0mdi4M7XhVA>