From owner-freebsd-arch@FreeBSD.ORG Tue Feb 26 20:32:35 2008 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A8AD106567B for ; Tue, 26 Feb 2008 20:32:35 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from mail.netplex.net (mail.netplex.net [204.213.176.10]) by mx1.freebsd.org (Postfix) with ESMTP id 068F713C45B for ; Tue, 26 Feb 2008 20:32:34 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.netplex.net (8.14.2/8.14.2/NETPLEX) with ESMTP id m1QKWXUr006784; Tue, 26 Feb 2008 15:32:33 -0500 (EST) X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.netplex.net) X-Greylist: Message whitelisted by DRAC access database, not delayed by milter-greylist-4.0 (mail.netplex.net [204.213.176.10]); Tue, 26 Feb 2008 15:32:33 -0500 (EST) Date: Tue, 26 Feb 2008 15:32:33 -0500 (EST) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: John Baldwin In-Reply-To: <200802261524.30384.jhb@FreeBSD.org> Message-ID: References: <200802261524.30384.jhb@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: arch@freebsd.org Subject: Re: Cleaning up FILE in stdio.. X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Eischen List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Feb 2008 20:32:35 -0000 On Tue, 26 Feb 2008, John Baldwin wrote: > Way back in the 4.x days we had a fiasco over changing the size of FILE > (struct __sFILE) to add locking for multithreaded apps because > the 'stdin', 'stdout', and 'stderr' symbols were direct references to the > global array of FILE objects. The first fix was to move the locking fields > into a private 'struct __sFILEX' to preserve the size of FILE. Later the > stdin/out/err symbols were fixed to reference standalone pointers instead of > the global array. Given that, I think at this point we can safely merge > __sFILEX back into __sFILE w/o breaking anything. This is assuming that the > contents and layout of FILE are not a public ABI (i.e. we malloc the things > internally and consumers should just treat the pointer value as a cookie and > not grub around in the internals). In addition to removing the __sFILEX > stuff, I'd like to change the fd member of FILE to be an int so you can open > more than 32k files via fopen(). Otherwise, if fopen() gets an fd that is > > SHORT_MAX, it gets sign extended when the fd is passed to read(), close(), > etc. and those calls fail with EBADF. > > Comments? Try it and see if anything breaks? -- DE