При поиске файла библиотеки из нужной папки мое приложение в настоящее время делает несколько lstat для возможных местоположений местоположений. Теперь мне интересно, вызывают ли эти lstat (приложение является веб-службой, таким образом, может быть сотни lstat в секунду) всегда дополнительный поиск диска, или эти запросы кэшируются?
Система Linux (ядро 2.6.) С файловой системой на основе ext4.
Часть PHP-CGI strace:
PHP-CGI strace:
lstat("/home/www/mydomain.com/inc/myLibrary/php/classes/myClass.php", 0x7fffa805a710) = -1 ENOENT (No such file or directory)
lstat("/usr/share/php/inc/myLibrary/php/classes/myClass.php", 0x7fffa805a710) = -1 ENOENT (No such file or directory)
getcwd("/home/www/mydomain.com/misc", 4096) = 32
lstat("/home/www/mydomain.com/misc/./inc/myLibrary/php/classes/myClass.php", 0x7fffa805a710) = -1 ENOENT (No such file or directory)
lstat("/home/www/mydomain.com/inc/inc/myLibrary/php/classes/myClass.php", 0x7fffa805a710) = -1 ENOENT (No such file or directory)
lstat("/home/www/mydomain.com/inc/myLibrary/php/classes/myClass.php", 0x7fffa805a660) = -1 ENOENT (No such file or directory)
lstat("/usr/share/php/inc/myLibrary/php/classes/myClass.php", 0x7fffa805a660) = -1 ENOENT (No such file or directory)
getcwd("/home/www/mydomain.com/misc", 4096) = 32
lstat("/home/www/mydomain.com/misc/./inc/myLibrary/php/classes/myClass.php", 0x7fffa805a660) = -1 ENOENT (No such file or directory)
lstat("/home/www/mydomain.com/inc/inc/myLibrary/php/classes/myClass.php", 0x7fffa805a660) = -1 ENOENT (No such file or directory)
getcwd("/home/www/mydomain.com/misc", 4096) = 32
lstat("/home/www/mydomain.com/misc/inc/myLibrary/php/classes/myClass.php", 0x7fffa805c7c0) = -1 ENOENT (No such file or directory)
lstat("/home/www/mydomain.com/misc/inc/myLibrary/php/classes", 0x7fffa805c600) = -1 ENOENT (No such file or directory)
lstat("/home/www/mydomain.com/misc/inc/myLibrary/php", 0x7fffa805c450) = -1 ENOENT (No such file or directory)
lstat("/home/www/mydomain.com/misc/inc/myLibrary", 0x7fffa805c2a0) = -1 ENOENT (No such file or directory)
lstat("/home/www/mydomain.com/misc/inc", 0x7fffa805c0f0) = -1 ENOENT (No such file or directory)
open("/home/www/mydomain.com/misc/inc/myLibrary/php/classes/myClass.php", O_RDONLY) = -1 ENOENT (No such file or directory)
/* FILE FOUND */
open("/home/www/mydomain.com/inc/classes/myClass.php", O_RDONLY) = 7
fstat(7, {st_mode=S_IFREG|0775, st_size=7734, ...}) = 0
fstat(7, {st_mode=S_IFREG|0775, st_size=7734, ...}) = 0
fstat(7, {st_mode=S_IFREG|0775, st_size=7734, ...}) = 0
fstat(7, {st_mode=S_IFREG|0775, st_size=7734, ...}) = 0
mmap(NULL, 7734, PROT_READ, MAP_SHARED, 7, 0) = 0x7f2225786000
stat("/home/www/mydomain.com/inc/classes/myClass.php", {st_mode=S_IFREG|0775, st_size=7734, ...}) = 0