Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: unlimited file descripters causes problems for zsh-4.0.2



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   



Messages sorted by: Reverse Date, Date, Thread, Author