Hello,
Looking at what happens when opening a regular file in Tcl to read it. I discovered that a lot of syscall are made in addition to the 'open' call.
I am running on Linux, and tracing the "/path/to/file" file opening on Tcl 8.6.6 gives:
lstat("/path", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/path/to", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/path/to/file", O_RDONLY) = 3
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
ioctl(3, TCGETS, 0x7fff5efc0740) = -1 ENOTTY (Inappropriate ioctl for device)
I am working on a Tcl software where hundreds of files in a directory tree need to be read [1]. I would like to optimize this process so I wonder how the total number of syscalls can be reduced.
Is there a way to open a file for read only that will only produce a 'open' call to the system?
Regards,
Xavier
[1]
http://modules.sourceforge.net/