From mboxrd@z Thu Jan 1 00:00:00 1970 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes From: "Bart Schaefer" Message-Id: <990130151858.ZM18216@candle.brasslantern.com> Date: Sat, 30 Jan 1999 15:18:57 -0800 In-Reply-To: <990130134019.ZM16947@candle.brasslantern.com> Comments: In reply to "Bart Schaefer" "Good grief! Thousands of calls to stat()" (Jan 30, 1:40pm) References: <990130134019.ZM16947@candle.brasslantern.com> X-Mailer: Z-Mail (4.0b.820 20aug96) To: zsh-workers@sunsite.auc.dk Subject: Re: Good grief! Thousands of calls to stat() MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailing-List: 5128 On Jan 30, 1:40pm, Bart Schaefer wrote: } Subject: Good grief! Thousands of calls to stat() } } first system call after entering createparamtable() is the brk() to allocate } the space, and it finally surfaces 4130 system calls later, nearly all of } which are stat("/dev/somethingorother"). I've traced this to the call to getlogin() when initializing the value of the LOGNAME variable. It appears to happen only when some or all of stdin, stdout, and stderr are redirected away from the terminal (the more of them that are redirected, the worse it gets). Although this doesn't have much effect on interactive shells, it probably causes the startup time of some zsh scripts to be significantly longer than the same script running under some other shell. Any suggestions what we could do about it? How about, trust the username obtained from getpwuid(), which is what happens in this case anyway after getlogin() finally gives up? } There's even a call to ioctl(0, TIOCGWINSZ, ...) That one happens when TERM is imported from the environment, so it must be something internal to tgetent() via init_term() via termsetfn(). This is another thing that probably shouldn't happen when the shell is not an interactive one. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com