How to sync a file on FreeBSD?

2011-07-22 Thread Unga
Hi all 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. Best regards Unga ___

Re: How to sync a file on FreeBSD?

2011-07-22 Thread Polytropon
On Thu, 21 Jul 2011 23:44:00 -0700 (PDT), 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. Maybe you can use system(/bin/sync);

Re: How to sync a file on FreeBSD?

2011-07-22 Thread Alejandro Imass
If you used fsync it should write to permanent storage immediately, and it's no longer the OS' problem. If it's not flushing immediately, maybe the mystery is at the filesystem level or even hardware, both of which you didn't provide. When you say 'users' are they looking at the file via NFS or

Re: How to sync a file on FreeBSD?

2011-07-22 Thread C. P. Ghost
On Fri, Jul 22, 2011 at 8:44 AM, Unga unga...@yahoo.com wrote: Hi all 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. It shouldn't matter:

Re: How to sync a file on FreeBSD?

2011-07-22 Thread Alexander Best
On Fri Jul 22 11, C. P. Ghost wrote: On Fri, Jul 22, 2011 at 8:44 AM, Unga unga...@yahoo.com wrote: Hi all 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

Re: How to sync a file on FreeBSD?

2011-07-22 Thread Pieter de Goeje
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

Re: How to sync a file on FreeBSD? [SOLVED]

2011-07-22 Thread Unga
--- On Fri, 7/22/11, Pieter de Goeje pie...@degoeje.nl wrote: From: Pieter de Goeje pie...@degoeje.nl Subject: Re: How to sync a file on FreeBSD? To: freebsd-questions@freebsd.org Cc: Unga unga...@yahoo.com Date: Friday, July 22, 2011, 7:37 PM On Friday, July 22, 2011 08:44:00 AM Unga

Re: How to sync a file on FreeBSD? [SOLVED]

2011-07-22 Thread Michael Sierchio
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 unga...@yahoo.com wrote: --- On Fri, 7/22/11,

Re: How to sync a file on FreeBSD? [SOLVED]

2011-07-22 Thread Polytropon
On Fri, 22 Jul 2011 07:37:48 -0700, Michael Sierchio wrote: This is extremely important, esp. with Softupdates, since fsync() does not guarantee a flush of all buffers to the medium. But wouldn't sync() (see man 2 sync) make sure that all buffers, even in regards to soft updates, get

Re: How to sync a file on FreeBSD? [SOLVED]

2011-07-22 Thread Michael Sierchio
On Fri, Jul 22, 2011 at 7:42 AM, Polytropon free...@edvax.de wrote: But wouldn't sync() (see man 2 sync) make sure that all buffers, even in regards to soft updates, get immediately flushed / written? Apparently not. I think most of Matt Dillon's notes are still relevant.