From owner-freebsd-questions@FreeBSD.ORG Fri Jul 22 14:37:49 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E80D1065672 for ; Fri, 22 Jul 2011 14:37:49 +0000 (UTC) (envelope-from kudzu@tenebras.com) Received: from mail-yi0-f54.google.com (mail-yi0-f54.google.com [209.85.218.54]) by mx1.freebsd.org (Postfix) with ESMTP id 17F388FC14 for ; Fri, 22 Jul 2011 14:37:48 +0000 (UTC) Received: by yic13 with SMTP id 13so1496831yic.13 for ; Fri, 22 Jul 2011 07:37:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.125.233 with SMTP id z69mr2321299yhh.231.1311345468193; Fri, 22 Jul 2011 07:37:48 -0700 (PDT) Received: by 10.236.61.39 with HTTP; Fri, 22 Jul 2011 07:37:48 -0700 (PDT) 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> Date: Fri, 22 Jul 2011 07:37:48 -0700 Message-ID: From: Michael Sierchio To: Unga Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-questions@freebsd.org Subject: Re: How to sync a file on FreeBSD? [SOLVED] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jul 2011 14:37:49 -0000 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 wrote: > --- On Fri, 7/22/11, Pieter de Goeje wrote: > >> From: Pieter de Goeje >> Subject: Re: How to sync a file on FreeBSD? >> To: freebsd-questions@freebsd.org >> Cc: "Unga" >> 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" >