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

Hugh number of file descriptor checks



I did some system call traces of a c program while I discovered zsh doing a 
large amount of file descriptor checks during startup which seem unnecessary.

Doing a simple strace like "strace zsh -c 'echo hello'" produces an output of 
about 4280 system calls which include a sequence of 4032 system calls like:

    fcntl(64, F_GETFL)      = -1 EBADF (Bad file descriptor)
    fcntl(65, F_GETFL)      = -1 EBADF (Bad file descriptor)
    fcntl(66, F_GETFL)      = -1 EBADF (Bad file descriptor)
    .................. sequence continues ..................
    fcntl(4092, F_GETFL)    = -1 EBADF (Bad file descriptor)
    fcntl(4093, F_GETFL)    = -1 EBADF (Bad file descriptor)
    fcntl(4094, F_GETFL)    = -1 EBADF (Bad file descriptor)
    fcntl(4095, F_GETFL)    = -1 EBADF (Bad file descriptor)

I checked if bash or debian's almquist shell do these kind of system calls but 
they don't. There may be a good reason why zsh does these checks but they 
decrease zsh's performance for non interactive shells, especially on short 
scripts.

If they could be removed zsh would be nearly as effective as bash.

Number of system calls: "strace zsh -c 'echo hello'"
    dash:  43
    bash: 169
    zsh: 4285


zsh verion 4.3.10 (x86_64-unknown-linux-gnu) (ubuntu karmic)

Attachment: signature.asc
Description: This is a digitally signed message part.



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