From dcp1990@styx.flinkpoyd.homeunix.com  Mon Aug 16 02:21:48 2004
Return-Path: <dcp1990@styx.flinkpoyd.homeunix.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 59F7B16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 16 Aug 2004 02:21:48 +0000 (GMT)
Received: from lakermmtao01.cox.net (lakermmtao01.cox.net [68.230.240.38])
	by mx1.FreeBSD.org (Postfix) with ESMTP id D9C9B43D31
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 16 Aug 2004 02:21:47 +0000 (GMT)
	(envelope-from dcp1990@styx.flinkpoyd.homeunix.com)
Received: from styx.flinkpoyd.homeunix.com ([68.226.93.87])
          by lakermmtao01.cox.net
          (InterMail vM.6.01.03.02.01 201-2131-111-104-103-20040709)
          with ESMTP
          id <20040816022146.OJNK15934.lakermmtao01.cox.net@styx.flinkpoyd.homeunix.com>;
          Sun, 15 Aug 2004 22:21:46 -0400
Received: by styx.flinkpoyd.homeunix.com (Postfix, from userid 1001)
	id 797EE409E; Sun, 15 Aug 2004 22:21:46 -0400 (EDT)
Message-Id: <20040816022146.797EE409E@styx.flinkpoyd.homeunix.com>
Date: Sun, 15 Aug 2004 22:21:46 -0400 (EDT)
From: Dan Ponte <dcp1990@cox.net>
Reply-To: Dan Ponte <amigan@gmail.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc: uau@users.sourceforge.net
Subject: When fread()ing with buffering turned off, many syscalls invoked.
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         70511
>Category:       kern
>Synopsis:       [libc] When fread(3)ing with buffering turned off, many syscalls invoked.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 16 02:30:21 GMT 2004
>Closed-Date:    
>Last-Modified:  Sat Oct 10 17:20:55 UTC 2009
>Originator:     Dan Ponte
>Release:        FreeBSD 5.2.1-RELEASE-p9 i386
>Organization:
Unix Users Anonymous
>Environment:
System: FreeBSD styx.cox.net 5.2.1-RELEASE-p9 FreeBSD 5.2.1-RELEASE-p9 #7: Thu Jul 1 13:17:08 EDT 2004 dcp1990@styx.cox.net:/usr/obj/usr/src/sys/STYX i386

Python 2.2.2
	
>Description:
	When calling fread and buffering turned off, a read() syscall is made for each byte. With large limits, this may take a while and is very inefficient.
>How-To-Repeat:
	In python, enter the following command:
		t=file('bigfile', 'r', 0).read(10000000)
, replacing 'bigfile' with a large file. Notice how it takes a while to run. Now, start Python with truss and enter the same, and notice the flood of read() syscalls.
>Fix:
	Change __srefill() in stdio to read blocks at a time, instead of one byte.
	


>Release-Note:
>Audit-Trail:
>Unformatted:
