zsh-workers
 help / color / mirror / code / Atom feed
* System calls in zsh
@ 1998-04-23 19:45 Nik Gervae
  1998-04-23 20:01 ` Mirar
  1998-04-23 20:46 ` Dan Nelson
  0 siblings, 2 replies; 3+ messages in thread
From: Nik Gervae @ 1998-04-23 19:45 UTC (permalink / raw)
  To: zsh-workers

Hello. I've been using zsh 3.0.0 on IRIX for a while here at work, and we
just started an evaluation of shell script efficiency that prompted me to
ask this. It seems that if you create an empty zsh script and run it, it
invokes these system calls (which I got using "par -s -S"):

exit             : 1 times
read             : 12 times
open             : 12 times
close            : 11 times
time             : 3 times
brk              : 5 times
getpid           : 5 times
getuid           : 5 times
access           : 1 times
syssgi           : 5 times
times            : 1 times
getgid           : 4 times
ioctl            : 8 times
sysmp            : 2 times
execve           : 1 times
fcntl            : 5 times
lseek64          : 1 times
sigreturn        : 1 times
gethostname      : 1 times
getdomainname    : 1 times
gettimeofday     : 1 times
prctl            : 1 times
mmap             : 2 times
getrlimit        : 8 times
xstat            : 5 times
fxstat           : 9 times
sigaction        : 3 times
ngetdents        : 3 times

Can anyone explain why read() and open() are called so many times for an
empty shell script? The Bourne and Korn shells here invoke them twice each.
zsh seems to be expending a bit more effort here than might be necessary.

--Nik


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: System calls in zsh
  1998-04-23 19:45 System calls in zsh Nik Gervae
@ 1998-04-23 20:01 ` Mirar
  1998-04-23 20:46 ` Dan Nelson
  1 sibling, 0 replies; 3+ messages in thread
From: Mirar @ 1998-04-23 20:01 UTC (permalink / raw)
  To: Nik Gervae; +Cc: zsh-workers

Nik Gervae <Nik@pdi.com> writes:

> Hello. I've been using zsh 3.0.0 on IRIX for a while here at work, and we
> just started an evaluation of shell script efficiency that prompted me to
> ask this. It seems that if you create an empty zsh script and run it, it
> invokes these system calls (which I got using "par -s -S"):

strace on linux sais:

 | mistel% strace zsh -c '' 2>&1 | grep open
 | open("/etc/ld.so.cache", O_RDONLY)      = 4
 | open("/usr/local/lib/libtermcap.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
 | open("/usr/lib/libtermcap.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
 | open("/lib/libtermcap.so.2", O_RDONLY)  = 4
 | open("/usr/local/lib/libc.so.5", O_RDONLY) = -1 ENOENT (No such file or directory)
 | open("/usr/lib/libc.so.5", O_RDONLY)    = -1 ENOENT (No such file or directory)
 | open("/lib/libc.so.5", O_RDONLY)        = 4
 | open("/usr/share/locale/C/LC_MESSAGES", O_RDONLY) = -1 ENOENT (No such file or directory)
 | open("/usr/share/locale/C/LC_MONETARY", O_RDONLY) = -1 ENOENT (No such file or directory)
 | open("/usr/share/locale/C/LC_COLLATE", O_RDONLY) = -1 ENOENT (No such file or directory)
 | open("/usr/share/locale/C/LC_TIME", O_RDONLY) = -1 ENOENT (No such file or directory)
 | open("/usr/share/locale/C/LC_NUMERIC", O_RDONLY) = -1 ENOENT (No such file or directory)
 | open("/usr/share/locale/iso_8859_1/LC_CTYPE", O_RDONLY) = -1 ENOENT (No such file or directory)
 | open("/dev", O_RDONLY)                  = 4
 | open("/dev/ttypc", O_RDWR)              = 4
 | open("/etc/nsswitch.conf", O_RDONLY)    = 4
 | open("/etc/passwd", O_RDONLY)           = 4
 | open("/dev", O_RDONLY)                  = 4
 | open("/var/run/utmp", O_RDONLY)         = 4
 | open("/usr/share/locale/iso_8859_1/LC_CTYPE", O_RDONLY) = -1 ENOENT (No such file or directory)
 | open("/etc/zshenv", O_RDONLY)           = -1 ENOENT (No such file or directory)
 | open("/home/mirar/.zshenv", O_RDONLY)   = 4
 | open("/etc/passwd", O_RDONLY)           = 4
 | open("/users/mirar/bin/zsh-compctl", O_RDONLY) = 4
 | open("/home/mirar/bin", O_RDONLY)       = 4
 | open("/usr/local/bin", O_RDONLY)        = 4
 | open("/usr/local/share/bin", O_RDONLY)  = 4
 | open("/usr/bin", O_RDONLY)              = 4
 | open("/bin", O_RDONLY)                  = 4
 | open("/dev/null", O_RDONLY)             = 4
 | mistel% 

The first 10-or-so seems to be locale stuff, the next 8 is probably
tty stuff and finding my home directory (user directory).
The last 6 has someting with running the command '' to do. 
(that's my path).


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: System calls in zsh
  1998-04-23 19:45 System calls in zsh Nik Gervae
  1998-04-23 20:01 ` Mirar
@ 1998-04-23 20:46 ` Dan Nelson
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Nelson @ 1998-04-23 20:46 UTC (permalink / raw)
  To: Nik Gervae, zsh-workers

In the last episode (Apr 23), Nik Gervae said:
> Hello. I've been using zsh 3.0.0 on IRIX for a while here at work,
> and we just started an evaluation of shell script efficiency that
> prompted me to ask this. It seems that if you create an empty zsh
> script and run it, it invokes these system calls (which I got using
> "par -s -S"):
> 
> exit             : 1 times
> read             : 12 times
> open             : 12 times
> close            : 11 times
[etc]
> Can anyone explain why read() and open() are called so many times for
> an empty shell script? The Bourne and Korn shells here invoke them
> twice each. zsh seems to be expending a bit more effort here than
> might be necessary.

Check to see which files are being opened and read.  On FreeBSD, a 
zsh -f -c '' opens the following:
/var/run/dev.db, /dev/tty, /etc/pwd.db, /etc/zshenv, /dev/null, and
takes .02 seconds from exec() to exit().

If you forgot to put a -f on your zsh commandline, it's probably
reading your zprofile, zshrc, zshenv, and zshrc files.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-04-23 20:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-04-23 19:45 System calls in zsh Nik Gervae
1998-04-23 20:01 ` Mirar
1998-04-23 20:46 ` Dan Nelson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).