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

Good grief! Thousands of calls to stat()



In the course of looking at Drazen's tty-initialization bugs/questions, I
happened to try running

strace -f zsh -i 2>& 1 > /dev/null < /dev/null

(for version 3.1.6-pws-6).  Imagine my surprise when hundreds of screenfuls
of calls to stat() went by -- in fact, there appears to be a loop that calls
stat() once for each file in /dev, and that loop runs three times.

After much peering at the surrounding output, I finally stuck some calls to
write() into setupvals() and tracked it as far as createparamtable() -- the
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").

Anybody have any idea what's going on here?  I'll try to narrow it further,
but with all the functions that get run callback-style when certain of the
parameters are changed, it's a real pain.

There's even a call to ioctl(0, TIOCGWINSZ, ...) happening among those 4130
system calls, which is really strange because by that time SHTTY is already
fd 10 and only ioctl(SHTTY, TIOCGWINSZ, ...) appears in the zsh source.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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