在与 PHP 源码搏斗了半个小时后,我放弃了。 :P 问题是 - 在 Gentoo Linux 系统上,PHP freeze() 函数调用归结为什么系统调用?我遇到了一些问题(比如每 20 次循环迭代中阻塞 30 秒类问题),我想知道为什么会这样。
// example: $stream = fopen(FILE, 'rb') or die('???');
$md = stream_get_meta_data($stream);
echo $md['wrapper_type'];
flock($stream);
if this prints
plainfile then the call to the php function flock() is handled by php_stdiop_set_option(...) which calls flock(). Depending on whether PHP was compiled with HAVE_FLOCK or not this may be the system call
flock() http://www.kernel.org/doc/man-pages/online/pages/man2/flock.2.html or a function defined in flock_compat.c which utilizes
fcntl() http://www.kernel.org/doc/man-pages/online/pages/man2/fcntl.2.html. On my gentoo system PHP was compiled with HAVE_FLOCK.
main/streams/plain_wrapper.c @ static int php_stdiop_set_option(...):
case PHP_STREAM_OPTION_LOCKING:
if (fd == -1) {
return -1;
}
if ((zend_uintptr_t) ptrparam == PHP_STREAM_LOCK_SUPPORTED) {
return 0;
}
if (!flock(fd, value)) {
data->lock_flag = value;
return 0;
} else {
return -1;
}
break;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)