From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6277 invoked from network); 19 Oct 2001 17:56:58 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 19 Oct 2001 17:56:58 -0000 Received: (qmail 7266 invoked by alias); 19 Oct 2001 17:56:49 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 16088 Received: (qmail 7229 invoked from network); 19 Oct 2001 17:56:47 -0000 From: Bart Schaefer Message-Id: <1011019175644.ZM9169@candle.brasslantern.com> Date: Fri, 19 Oct 2001 17:56:44 +0000 In-Reply-To: <1011019164041.ZM8348@candle.brasslantern.com> Comments: In reply to Bart Schaefer "Re: unlimited file descripters causes problems for zsh-4.0.2" (Oct 19, 4:40pm) References: <200110182344.TAA12655@sassy.aa.ops.us.uu.net> <1011019164041.ZM8348@candle.brasslantern.com> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.dk Subject: Re: unlimited file descripters causes problems for zsh-4.0.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Oct 19, 4:40pm, Bart Schaefer wrote: } } What I'm more concerned about is closeallelse() in exec.c, which is going } to make up to several billion close() calls (plus a lot of unnecessary } looping) every time a process with a redirection is started; but which I } think could be caused to leak descriptors if it doesn't scan all the way } to the actual maximum fd. Here's a suggestion: Once, at startup, we scan all the way to zopenmax() looking for open descriptors, and set a global to the largest number we find. (We still use a constant on the order of 1024 for fdtable_size.) Thereafter zsh itself is in control of the descriptor numbers, so we should never have to scan beyond that number again, so we use that global in closeallelse() instead of calling zopenmax() again. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net