From owner-freebsd-questions@FreeBSD.ORG Wed Sep 15 20:15:23 2010 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F2331065673 for ; Wed, 15 Sep 2010 20:15:23 +0000 (UTC) (envelope-from cyberleo@cyberleo.net) Received: from paka.cyberleo.net (paka.cyberleo.net [66.219.31.21]) by mx1.freebsd.org (Postfix) with ESMTP id 4A7D48FC0A for ; Wed, 15 Sep 2010 20:15:22 +0000 (UTC) Received: from [172.16.44.4] (h-74-2-96-2.chcgilgm.static.covad.net [74.2.96.2]) by paka.cyberleo.net (Postfix) with ESMTPSA id B0AC42968A; Wed, 15 Sep 2010 16:15:21 -0400 (EDT) Message-ID: <4C912868.6090403@cyberleo.net> Date: Tue, 14 Sep 2010 15:11:20 -0500 From: CyberLeo Kitsana User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.9) Gecko/20100911 Lightning/1.0b3pre Thunderbird/3.1.3 MIME-Version: 1.0 To: FreeBSD Questions X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: CyberLeo Subject: Discard file cache 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: Wed, 15 Sep 2010 20:15:23 -0000 Hi! I'm helping port a utility [1] to program the EyeFi card [2] and I seem to be running into problems properly manipulating the configuration. The card is programmed by writing encoded commands to certain hidden files on the card, and reading the coded responses back from other files. Since the card modifies the data in these files independently of the host operating system, there is a need to avoid all caching (read and write) whenever interacting with the card's interface. fsync(2) works for eliminating write caching, so that's no issue. While the Linux port of the software successfully accomplishes avoiding read caching by utilizing posix_fadvise and POSIX_FADV_DONTNEED to clear the caches for a particular file, the same does not appear to function on FreeBSD. I have also tried using msync with MS_INVALIDATE, but this doesn't appear to work either. Is there an official (or at least consistent) API for discarding a file's cached read data, so that it may be fetched afresh from the backing store? Thanks! [1] http://git.cyberleo.net/eyefi-config.git [2] http://www.eye.fi/ -- Fuzzy love, -CyberLeo Technical Administrator CyberLeo.Net Webhosting http://www.CyberLeo.Net Furry Peace! - http://wwww.fur.com/peace/