From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4012 invoked from network); 15 Apr 2005 16:19:32 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 15 Apr 2005 16:19:32 -0000 Received: (qmail 62949 invoked from network); 15 Apr 2005 16:19:26 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 15 Apr 2005 16:19:26 -0000 Received: (qmail 9638 invoked by alias); 15 Apr 2005 16:19:23 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21145 Received: (qmail 9629 invoked from network); 15 Apr 2005 16:19:23 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 15 Apr 2005 16:19:23 -0000 Received: (qmail 62689 invoked from network); 15 Apr 2005 16:19:23 -0000 Received: from vms046pub.verizon.net (206.46.252.46) by a.mx.sunsite.dk with SMTP; 15 Apr 2005 16:19:18 -0000 Received: from candle.brasslantern.com ([4.11.1.68]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0IEZ00JSUXC4NSR6@vms046.mailsrvcs.net> for zsh-workers@sunsite.dk; Fri, 15 Apr 2005 11:19:17 -0500 (CDT) Received: from candle.brasslantern.com (IDENT:schaefer@localhost [127.0.0.1]) by candle.brasslantern.com (8.12.11/8.12.11) with ESMTP id j3FGJFpB019007 for ; Fri, 15 Apr 2005 09:19:15 -0700 Received: (from schaefer@localhost) by candle.brasslantern.com (8.12.11/8.12.11/Submit) id j3FGJEsD019006 for zsh-workers@sunsite.dk; Fri, 15 Apr 2005 09:19:14 -0700 Date: Fri, 15 Apr 2005 16:19:14 +0000 From: Bart Schaefer Subject: Re: PATCH: allocating a new file descriptor In-reply-to: <200504151027.j3FARBdH004522@news01.csr.com> To: Zsh hackers list Message-id: <1050415161914.ZM19005@candle.brasslantern.com> MIME-version: 1.0 X-Mailer: Z-Mail (5.0.0 30July97) Content-type: text/plain; charset=us-ascii References: <200504121257.j3CCvkXr003286@news01.csr.com> <1050414045748.ZM13551@candle.brasslantern.com> <200504140949.j3E9n5Kp006216@news01.csr.com> <1050414142337.ZM14042@candle.brasslantern.com> <200504141616.j3EGGR7O023489@news01.csr.com> <20050414181020.GA5064@sc> <200504151027.j3FARBdH004522@news01.csr.com> Comments: In reply to Peter Stephenson "Re: PATCH: allocating a new file descriptor" (Apr 15, 11:27am) X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 On Apr 15, 11:27am, Peter Stephenson wrote: } } > I also noticed several problems when fidling with fds used } > internally by zsh (zsocket -d10 or -d11 ended up in a core } > dump). } } Yes, it doesn't check for existing use of the fd by the shell. } } The same problem exists with the new syntax when closing fd's; I've made } it check for special fd's, which are those from 10 upwards marked as for } internal use. This covers 10, but not 11; I'm not sure what opened } that, but I think it's some library rather than the shell itself. } If we can track it down it could be marked as in internal use, too. } } (Maybe it's about time we introduced zwarn and friends to stdarg.h...) Also maybe it's time we introduced an API in the main part of zsh for opening and closing files, so that we can stop doing things like this ... } -unsigned char *fdtable; } +mod_export unsigned char *fdtable; [...] } Index: Src/Modules/socket.c } =================================================================== } + if (targetfd <= max_zsh_fd && fdtable[targetfd] != FDT_UNUSED) { ... and instead encapsulate those sorts of tests in the API functions. The number of exported globals is starting to bother me; it feels as if every second patch that's gone by in the past few months has exported another previously-hidden global symbol.