From owner-freebsd-arch@FreeBSD.ORG Tue Feb 26 20:24:39 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 6CF0F1065671 for ; Tue, 26 Feb 2008 20:24:39 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from speedfactory.net (mail.speedfactory.net [66.23.216.219]) by mx1.freebsd.org (Postfix) with ESMTP id E82E713C4D1 for ; Tue, 26 Feb 2008 20:24:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from server.baldwin.cx (unverified [66.23.211.162]) by speedfactory.net (SurgeMail 3.8s) with ESMTP id 233492774-1834499 for ; Tue, 26 Feb 2008 15:24:13 -0500 Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.2/8.14.2) with ESMTP id m1QKOW69022782 for ; Tue, 26 Feb 2008 15:24:32 -0500 (EST) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: arch@FreeBSD.org Date: Tue, 26 Feb 2008 15:24:30 -0500 User-Agent: KMail/1.9.7 MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200802261524.30384.jhb@FreeBSD.org> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Tue, 26 Feb 2008 15:24:32 -0500 (EST) X-Virus-Scanned: ClamAV 0.91.2/6003/Tue Feb 26 06:34:31 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: Subject: Cleaning up FILE in stdio.. X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list 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:24:39 -0000 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? -- John Baldwin