From owner-freebsd-questions@FreeBSD.ORG Fri Jul 22 13:16:33 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 B1CEE106566B for ; Fri, 22 Jul 2011 13:16:33 +0000 (UTC) (envelope-from unga888@yahoo.com) Received: from nm5-vm0.bullet.mail.bf1.yahoo.com (nm5-vm0.bullet.mail.bf1.yahoo.com [98.139.213.150]) by mx1.freebsd.org (Postfix) with SMTP id 5FC328FC15 for ; Fri, 22 Jul 2011 13:16:33 +0000 (UTC) Received: from [98.139.212.150] by nm5.bullet.mail.bf1.yahoo.com with NNFMP; 22 Jul 2011 13:16:32 -0000 Received: from [98.139.212.233] by tm7.bullet.mail.bf1.yahoo.com with NNFMP; 22 Jul 2011 13:16:32 -0000 Received: from [127.0.0.1] by omp1042.mail.bf1.yahoo.com with NNFMP; 22 Jul 2011 13:16:32 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 860813.86072.bm@omp1042.mail.bf1.yahoo.com Received: (qmail 31257 invoked by uid 60001); 22 Jul 2011 13:16:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1311340592; bh=NSXFSeReSA4axp6FJj7lL5dT/67J7GiLMdk70H6lNgw=; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=NNcRVg9xptkJZqSYamCVgtUhPbbO0vH/dGeZ2ioC9mm6DNd0ISmlQ4uPQ8mS0BasOuxAyI62qMATM6YXFu0V2QEI7oJrqGczQs8+/gFNoTLzhiBS37YknpzQITnOKLm1CRMAoF5TtOcoUwdDTnzVrMgKZMmcM6KUs87pM1yzG8c= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=dR4rB1U5E6W13k4UNsT7UjHBoKxDdjO9sbHQ2/QV1nJ9m0ZMqcoDNI0Y8Oa1NLddEAuuCTWD8my8pPUHS0HGp8kL1oHs8xr7wx1bN9W00wA2QKHKE91+1e7BKutNQceX/uSOS0JY5jLrHQZE6tkCfh2EezF9CYmF+vY2JBfavmk=; X-YMail-OSG: GO3XEXAVM1lx3xITgioe729SHjnSiAUqq9SelbvqGppN9TT KtFtYZEeSDDLx8hkebsyBIkCaDZ2gb8Tawq0LSXvqGAOiAFkKUDill4aZwfm eT3W42mEYT8sYn4r4gEdFKXxP7hwCG1GkD95PmrNuDxOCwgw70NVyGOPaz59 wHqicheRklxboPIaMpb.PVO0jwi3LiZrRoBt6f_1Gv5eEtD418JNlzW_vh3h A_qUqUaLypW_jGmtikQbeO3dJwwnRELiCu0j3_4UNnR7Ru4ZsT2wAhwSpj6m 0C3kHaNwGHzOjLqWmji9qD3cAdE3PE4TsFwc.TChTI_PQNGgaeJGe3MflWMJ n86DtyxOOMhzgMSQN7cN3AB2jeS_Zxg8rB.ZuCbM.5RekOlb7ZccVKaLhMwu PYnvSMMVhgeTsSbh0VV0- Received: from [112.134.98.73] by web160109.mail.bf1.yahoo.com via HTTP; Fri, 22 Jul 2011 06:16:32 PDT X-Mailer: YahooMailClassic/14.0.3 YahooMailWebService/0.8.112.310352 Message-ID: <1311340592.24555.YahooMailClassic@web160109.mail.bf1.yahoo.com> Date: Fri, 22 Jul 2011 06:16:32 -0700 (PDT) From: Unga To: freebsd-questions@freebsd.org In-Reply-To: <201107221337.15804.pieter@degoeje.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 13:16:33 -0000 --- 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