From owner-cvs-all Thu Nov 5 20:01:32 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id UAA12842 for cvs-all-outgoing; Thu, 5 Nov 1998 20:01:32 -0800 (PST) (envelope-from owner-cvs-all@FreeBSD.ORG) Received: from apollo.backplane.com (apollo.backplane.com [209.157.86.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id UAA12824; Thu, 5 Nov 1998 20:01:30 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.1/8.9.1) id UAA00767; Thu, 5 Nov 1998 20:01:20 -0800 (PST) (envelope-from dillon) Date: Thu, 5 Nov 1998 20:01:20 -0800 (PST) From: Matthew Dillon Message-Id: <199811060401.UAA00767@apollo.backplane.com> To: Joseph Koshy Cc: dag-erli@ifi.uio.no (Dag-Erling C. =?iso-8859-1?Q?Sm=F8rgrav?= ), cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: sendfile.2 (was Re: cvs commit: ...) References: <199811060342.TAA11021@hub.freebsd.org> Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk :> would be to actually use it in the stdio library for read operations :> on plain files: [f]getc(), fgets(), and fread(). The only difficulty :> here is in how to deal with file truncation issues, since accessing :> mmap'd pages beyond the file's size will segfault. : :For what its worth, the SFIO library from AT&T already supports :this. I don't remember what copyright it is released under though. : :Koshy : Well, it isn't that difficult to do... it would take maybe 20 minutes to implement. A simple MAP_PRIVATE replacement of __srefill() and maybe a little code to avoid unnecessary copy-on-write ops. There are two problems: First, how to deal with unexpected file truncation issues. Second, the extra syscalls involved: fstat(), mmap(), and munmap() would have to be called quite often (fstat() to check for file size changes). On the bright side, a relatively large map (e.g. 128K) could be used. Maybe a sequential operation detect flag to revert the behavior if there is excessive seeking/small-reads where syscall overhead is killer verses the read() overhead. -Matt Matthew Dillon Engineering, HiWay Technologies, Inc. & BEST Internet Communications & God knows what else. (Please include original email in any response) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message