From owner-freebsd-current@FreeBSD.ORG Thu May 14 14:54:18 2015 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E4AA428F for ; Thu, 14 May 2015 14:54:18 +0000 (UTC) Received: from erouter4.ore.mailhop.org (erouter4.ore.mailhop.org [54.148.38.162]) by mx1.freebsd.org (Postfix) with SMTP id BC3701556 for ; Thu, 14 May 2015 14:54:18 +0000 (UTC) Received: from ilsoft.org (unknown [73.34.117.227]) by outbound2.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA; Thu, 14 May 2015 14:53:12 +0000 (UTC) Received: from revolution.hippie.lan (revolution.hippie.lan [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id t4EEr5E7005972; Thu, 14 May 2015 08:53:05 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1431615185.1221.57.camel@freebsd.org> Subject: Re: Increase BUFSIZ to 8192 From: Ian Lepore To: Poul-Henning Kamp Cc: John-Mark Gurney , Adrian Chadd , Hans Petter Selasky , David Chisnall , Baptiste Daroussin , "current@freebsd.org" Date: Thu, 14 May 2015 08:53:05 -0600 In-Reply-To: <62511.1431589335@critter.freebsd.dk> References: <20150511230635.GA46991@ivaldir.etoilebsd.net> <20150512032307.GP37063@funkthat.com> <14994.1431412293@critter.freebsd.dk> <20150513080342.GE37063@funkthat.com> <55530CC3.1090204@selasky.org> <1431528249.1221.15.camel@freebsd.org> <20150513181347.GM37063@funkthat.com> <1431542835.1221.30.camel@freebsd.org> <20150514072155.GT37063@funkthat.com> <62511.1431589335@critter.freebsd.dk> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.12.10 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 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, 14 May 2015 14:54:19 -0000 On Thu, 2015-05-14 at 07:42 +0000, Poul-Henning Kamp wrote: > -------- > In message <20150514072155.GT37063@funkthat.com>, John-Mark Gurney writes: > > >Since you apprently missed my original reply, I said that we shouldn't > >abuse BUFSIZ for this work, and that it should be changed in mdXhl.c... > > Say what ? > > BUFSIZ is used entirely appropriately in MDXFileChunk(): For reading > a file into an algorithm. > > If in stead of open(2), fopen(3) had been used, the exact same thing > would happen, but using malloc space rather than stack space. > > I think we've got differing interpretations of what BUFSIZ is for. IMO, the one correct use of BUFSIZ outside of libc is "if you are going to call setbuf() the buffer you pass must be BUFSIZ bytes long." Over the years, it seems that many people have somehow gotten the impression that the intent was "BUFSIZ is the right/ideal/whatever size to allocate general purpose IO buffers in any program" and I don't believe that was ever the intent, or was ever correct. All such usage is erronious and must inevitably lead to the situation we've got now: it's so widely misused that it can't be changed in the context of its original purpose without pondering what the wider implications of the change might be. At least I'm inclined to ponder it. Apparently nobody else is. People running servers with more GB of ram than grains of sand on the beach won't care about things like 64k buffers used by /bin/sh to read a line of text, and all the world is big servers now, right? -- Ian