From owner-freebsd-current@FreeBSD.ORG Thu Aug 4 07:57:45 2005 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 743D216A41F; Thu, 4 Aug 2005 07:57:45 +0000 (GMT) (envelope-from PeterJeremy@optushome.com.au) Received: from mail20.syd.optusnet.com.au (mail20.syd.optusnet.com.au [211.29.132.201]) by mx1.FreeBSD.org (Postfix) with ESMTP id C229D43D45; Thu, 4 Aug 2005 07:57:44 +0000 (GMT) (envelope-from PeterJeremy@optushome.com.au) Received: from cirb503493.alcatel.com.au (c220-239-19-236.belrs4.nsw.optusnet.com.au [220.239.19.236]) by mail20.syd.optusnet.com.au (8.12.11/8.12.11) with ESMTP id j747vGJF017828 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Thu, 4 Aug 2005 17:57:25 +1000 Received: from cirb503493.alcatel.com.au (localhost.alcatel.com.au [127.0.0.1]) by cirb503493.alcatel.com.au (8.12.10/8.12.10) with ESMTP id j747vBSR001902; Thu, 4 Aug 2005 17:57:11 +1000 (EST) (envelope-from pjeremy@cirb503493.alcatel.com.au) Received: (from pjeremy@localhost) by cirb503493.alcatel.com.au (8.12.10/8.12.9/Submit) id j747vBfj001901; Thu, 4 Aug 2005 17:57:11 +1000 (EST) (envelope-from pjeremy) Date: Thu, 4 Aug 2005 17:57:11 +1000 From: Peter Jeremy To: Andrey Chernov , Maxim.Sobolev@portaone.com, Dan Nelson , "current@freebsd.org" Message-ID: <20050804075711.GB271@cirb503493.alcatel.com.au> References: <42F0CCD5.9090200@portaone.com> <20050803150117.GD93405@dan.emsphone.com> <42F0E9B2.9080208@portaone.com> <20050804060251.GA21228@nagual.pp.ru> <20050804063908.GA21871@nagual.pp.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050804063908.GA21871@nagual.pp.ru> User-Agent: Mutt/1.4.2i Cc: Subject: Re: Sub-optimal libc's read-ahead buffering behaviour X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2005 07:57:45 -0000 On Thu, 2005-Aug-04 10:39:09 +0400, Andrey Chernov wrote: >So (considering changing content like /dev/mem too), any buferization is >potentially dangerous here. fseek traditionally used as buferization >break, in case, say, between fread and fwrite. In case SEEK_CUR still uses >the buffer, it probably should not for character device. I can't see any reason for the current stdio behaviour: - If you're accessing a device with "magic" behaviour then it's not safe to read(2) 4KB (or whatever) when userland asks to fread(3) 512 bytes. - If the device doesn't have "magic" behaviour then you can just seek within the stdio buffer. That said, I've seen similar behaviour on other systems so it could be a subtle side-effect of POSIX. -- Peter Jeremy