当前位置: 首页 > 工具软件 > PHP Open Biz > 使用案例 >

PHP require_once 多次使用 lstat

仰雅昶
2023-12-01

1 背景

使用 strace 在观察 PHP 进程执行过程的时候,偶然发现有时候 require_once 一个文件,会出现多次 lstat,下次比上次少一个目录,如下使用了 7 次 lstat,lstat 是检查所给的文件或文件夹是否是软连接。

access("/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im/business/contract/IImBusinessService.php", F_OK) = 0
lstat("/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im/business/contract/IImBusinessService.php", {st_mode=S_IFREG|0644, st_size=4227, ...}) = 0
lstat("/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im/business/contract", {st_mode=S_IFDIR|0755, st_size=44, ...}) = 0
lstat("/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im/business", {st_mode=S_IFDIR|0755, st_size=28, ...}) = 0
lstat("/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im", {st_mode=S_IFDIR|0755, st_size=16, ...}) = 0
lstat("/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat", {st_mode=S_IFDIR|0755, st_size=4, ...}) = 0
lstat("/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58", {st_mode=S_IFDIR|0755, st_size=8, ...}) = 0
lstat("/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com", {st_mode=S_IFDIR|0755, st_size=14, ...}) = 0
open("/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im/business/contract/IImBusinessService.php", O_RDONLY) = 6
fstat(6, {st_mode=S_IFREG|0644, st_size=4227, ...}) = 0
fstat(6, {st_mode=S_IFREG|0644, st_size=4227, ...}) = 0
fstat(6, {st_mode=S_IFREG|0644, st_size=4227, ...}) = 0
mmap(NULL, 4227, PROT_READ, MAP_SHARED, 6, 0) = 0x7ff0ca2fd000
munmap(0x7ff0ca2fd000, 4227)            = 0
close(6)                                = 0

2 分析

2.1 什么情况下回调用 lstat

strace 列出来的都是系统调用,例如 显示 lstat,其实对应内核的 sys_lstat 方法,所以通过 systemtap 在 lstat 上面加埋点,就可以知道用户态的调用栈

probe kernel.function("sys_lstat") {
    printf("lstat ------------------ %d %s %s \n ",pid(),execname(), $$parms);
    print_ubacktrace();
}

奇怪的是没有返回任何结果,只能换个思路。Linux 还有一个 lstrace 命令,可以打印出用户态的一些方法,试试看

sudo ltrace -s1000 -fp 19215


[pid 19154] strlen("/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im/business/contract/IImBusinessService.php") = 112
[pid 19154] __ctype_b_loc()                                                                                   = 0x7f891d014710
[pid 19154] access("/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im/business/contract/IImBusinessService.php", 0) = 0
[pid 19154] strlen("/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im/business/contract/IImBusinessService.php") = 112
[pid 19154] strlen("/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im/business/contract/IImBusinessService.php") = 112
[pid 19154] __ctype_b_loc()                                                                                   = 0x7f891d014710
[pid 19154] malloc(1)                                                                                         = 0x3114d20
[pid 19154] strlen("/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im/business/contract/IImBusinessService.php") = 112
[pid 19154] __memcpy_chk(0x7fffe4b484f0, 0x7f88f0534548, 113, 4096)                                           = 0x7fffe4b484f0
[pid 19154] time(0)                                                                                           = 1474701650
[pid 19154] __lxstat(1, "/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im/business/contract/IImBusinessService.php", 0x7fffe4b483d0) = 0
[pid 19154] memcpy(0x7fffe4b482f0, "/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im/business/contract/IImBusinessService.php\0", 113) = 0x7fffe4b482f0
[pid 19154] __lxstat(1, "/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im/business/contract", 0x7fffe4b48200) = 0
[pid 19154] memcpy(0x7fffe4b48130, "/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im/business/contract\0", 90) = 0x7fffe4b48130
[pid 19154] __lxstat(1, "/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im/business", 0x7fffe4b48040) = 0
[pid 19154] memcpy(0x7fffe4b47f80, "/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im/business\0", 81) = 0x7fffe4b47f80
[pid 19154] __lxstat(1, "/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im", 0x7fffe4b47e90) = 0
[pid 19154] memcpy(0x7fffe4b47dd0, "/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im\0", 72) = 0x7fffe4b47dd0
[pid 19154] __lxstat(1, "/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat", 0x7fffe4b47ce0) = 0
[pid 19154] memcpy(0x7fffe4b47c20, "/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat\0", 69) = 0x7fffe4b47c20
[pid 19154] __lxstat(1, "/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58", 0x7fffe4b47b30)    = 0
[pid 19154] memcpy(0x7fffe4b47a80, "/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58\0", 64)   = 0x7fffe4b47a80
[pid 19154] __lxstat(1, "/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com", 0x7fffe4b47990)         =

对比上面 strace 的结果,可以知道 lstat 是 __lxstat 引发的,现在可以通过 __lxstat 来查看用户态的堆栈,同样还是要使用 systemtap

和内核不同的是,要用systemtap 调试用户态的代码,需要知道方法所在的动态库或者二进制程序,linux 下面有个 nm 命令可以知道那个动态库或者二进制程序包含了那些方法

~/projects/systemtap$ lsof -p 19215 | grep -E '(/lib/|/usr/)' | awk '{print $NF}' | while read file
> do
> echo "search $file ..."
> nm -D $file |grep __lxstat
> done
search /usr/local/anjuke-php-fpm/bin/php ...
                 U __lxstat
search /usr/lib/x86_64-linux-gnu/libpgm-5.1.so.0.0.118 ...
search /usr/lib/x86_64-linux-gnu/libzmq.so.3.1.0 ...
.....
search /usr/lib/x86_64-linux-gnu/libffi.so.6.0.1 ...
search /usr/lib/x86_64-linux-gnu/libroken.so.18.1.0 ...
                 U __lxstat
search /usr/lib/x86_64-linux-gnu/libhcrypto.so.4.1.0 ...
search /usr/lib/x86_64-linux-gnu/libasn1.so.8.0.0 ...
.....
search /lib/x86_64-linux-gnu/libpthread-2.19.so ...
search /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0 ...
search /lib/x86_64-linux-gnu/libgcrypt.so.11.8.2 ...
search /lib/x86_64-linux-gnu/libc-2.19.so ...
00000000000eb230 T __lxstat
00000000000eb230 T __lxstat64
search /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.1 ...


显然 /lib/x86_64-linux-gnu/libc-2.19.so 这个动态库里面定义了 __lxstat 方法,前面是 U 标示引用了这个方法,接下来使用 systemtap 试试


probe process("/lib/x86_64-linux-gnu/libc-2.19.so").function("__lxstat") {
    printf("__lxstat ------------------ %d %s %s \n ",pid(),execname(), $$parms);
    print_ubacktrace();
}

__lxstat ------------------ 20067 php vers=1 name="/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im/business/contract/IImBusinessService.php" buf={.st_dev=7147065726701298547, .st_ino=3402528249508490607, .st_nlink=3417503344780996723, .st_mode=1769174370, .st_uid=1936942446, .st_gid=1852793647, .__pad0=1667330676, .st_rdev=113, .st_size=-140728356941455, .st_blksize=8099847272696643592, .st_blocks=2, .st_atim={...}, .st_mtim={...}, .st_ctim={...}, .__glibc_reserved=[...]}
  0x7fd7b79b9230 : __lxstat64+0x0/0x50 [/lib/x86_64-linux-gnu/libc-2.19.so]
 0x761b74 : tsrm_realpath_r+0x384/0x9c0 [/usr/local/anjuke-php-fpm/bin/php]
 0x76281a : virtual_file_ex+0x17a/0x3d0 [/usr/local/anjuke-php-fpm/bin/php]
 0x76395c : tsrm_realpath+0xcc/0x1b0 [/usr/local/anjuke-php-fpm/bin/php]
 0x76b49e : php_resolve_path+0xae/0x590 [/usr/local/anjuke-php-fpm/bin/php]
 0x63442d : phar_find_in_include_path+0xfd/0x400 [/usr/local/anjuke-php-fpm/bin/php]
 0x780036 : _php_stream_open_wrapper_ex+0x216/0x460 [/usr/local/anjuke-php-fpm/bin/php]
 0x765771 : php_stream_open_for_zend_ex+0x31/0x220 [/usr/local/anjuke-php-fpm/bin/php]
 0x874b60 : ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER+0x3f0/0x590 [/usr/local/anjuke-php-fpm/bin/php]
 0x8371c8 : execute_ex+0x38/0x4a0 [/usr/local/anjuke-php-fpm/bin/php]
 0x7b9f40 : zend_call_function+0xa50/0xc90 [/usr/local/anjuke-php-fpm/bin/php]
 0x7dfbf7 : zend_call_method+0x1c7/0x3a0 [/usr/local/anjuke-php-fpm/bin/php]
 0x6892c7 : zif_spl_autoload_call+0x107/0x1d0 [/usr/local/anjuke-php-fpm/bin/php]
 0x7b9ee4 : zend_call_function+0x9f4/0xc90 [/usr/local/anjuke-php-fpm/bin/php]
 0x7ba80a : zend_lookup_class_ex+0x4aa/0x5b0 [/usr/local/anjuke-php-fpm/bin/php]
 0x7baf02 : zend_fetch_class_by_name+0x32/0xe0 [/usr/local/anjuke-php-fpm/bin/php]
 0x804ada : ZEND_FETCH_CLASS_SPEC_CONST_HANDLER+0x9a/0xd0 [/usr/local/anjuke-php-fpm/bin/php]
 0x8371c8 : execute_ex+0x38/0x4a0 [/usr/local/anjuke-php-fpm/bin/php]
 0x7c9aa3 : zend_execute_scripts+0x143/0x2f0 [/usr/local/anjuke-php-fpm/bin/php]
 0x87bcec : php_cli_server_dispatch_router.isra.12+0x10c/0x140 [/usr/local/anjuke-php-fpm/bin/php]
 ......
__lxstat ------------------ 20067 php vers=1 name="/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com" buf={.st_dev=7095191850619725871, .st_ino=8030604434456080243, .st_nlink=3636145922068669802, .st_mode=1718640943, .st_uid=1680683638, .st_gid=795831653, .__pad0=762343521, .st_rdev=3414407380874193250, .st_size=7147065726701298547, .st_blksize=28015, .st_blocks=7095191850619725871, .st_atim={...}, .st_mtim={...}, .st_ctim={...}, .__glibc_reserved=[...]}
  0x7fd7b79b9230 : __lxstat64+0x0/0x50 [/lib/x86_64-linux-gnu/libc-2.19.so]
 0x761b74 : tsrm_realpath_r+0x384/0x9c0 [/usr/local/anjuke-php-fpm/bin/php]
 0x7619cb : tsrm_realpath_r+0x1db/0x9c0 [/usr/local/anjuke-php-fpm/bin/php]
 0x7619cb : tsrm_realpath_r+0x1db/0x9c0 [/usr/local/anjuke-php-fpm/bin/php]
 0x7619cb : tsrm_realpath_r+0x1db/0x9c0 [/usr/local/anjuke-php-fpm/bin/php]
 0x7619cb : tsrm_realpath_r+0x1db/0x9c0 [/usr/local/anjuke-php-fpm/bin/php]
 0x7619cb : tsrm_realpath_r+0x1db/0x9c0 [/usr/local/anjuke-php-fpm/bin/php]
 0x7619cb : tsrm_realpath_r+0x1db/0x9c0 [/usr/local/anjuke-php-fpm/bin/php]
 0x76281a : virtual_file_ex+0x17a/0x3d0 [/usr/local/anjuke-php-fpm/bin/php]
 0x76395c : tsrm_realpath+0xcc/0x1b0 [/usr/local/anjuke-php-fpm/bin/php]
 0x76b49e : php_resolve_path+0xae/0x590 [/usr/local/anjuke-php-fpm/bin/php]
 0x63442d : phar_find_in_include_path+0xfd/0x400 [/usr/local/anjuke-php-fpm/bin/php]
 0x780036 : _php_stream_open_wrapper_ex+0x216/0x460 [/usr/local/anjuke-php-fpm/bin/php]
 0x765771 : php_stream_open_for_zend_ex+0x31/0x220 [/usr/local/anjuke-php-fpm/bin/php]
 0x874b60 : ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER+0x3f0/0x590 [/usr/local/anjuke-php-fpm/bin/php]
 0x8371c8 : execute_ex+0x38/0x4a0 [/usr/local/anjuke-php-fpm/bin/php]
 0x7b9f40 : zend_call_function+0xa50/0xc90 [/usr/local/anjuke-php-fpm/bin/php]
 0x7dfbf7 : zend_call_method+0x1c7/0x3a0 [/usr/local/anjuke-php-fpm/bin/php]
 0x6892c7 : zif_spl_autoload_call+0x107/0x1d0 [/usr/local/anjuke-php-fpm/bin/php]
 0x7b9ee4 : zend_call_function+0x9f4/0xc90 [/usr/local/anjuke-php-fpm/bin/php]

2.2 解析 tsrm_realpath_r

注意上面调用了 7 次 tsrm_realpath_r 方法(其实是递归引起的),前面我们用 strace 发现了 7 次 lstat 方法,也就是 tsrm_realpath_r 方法里面调用了 __lxstat 方法。查看 tsrm_realpath_r 这个方法,其实方法本身检查所给的路径文件或者目录的真是路径,去掉中间的软连接,所以从之前的分析可以看到是从最长的路径开始检查,每次少一次层目录,来检查是不是软连接,递归停止的时候,也就是停止检查的时候,这个地方非常关键。 要知道 tsrm_realpath_r 方法的执行轨迹,需要知道 systemtap 关于该方法的细节,可以用下面的命令

~/projects/systemtap$ stap -L 'process("/usr/local/anjuke-php-fpm/bin/php").function("*")' |grep realpath_cache_add
process("/usr/local/anjuke-php-fpm/bin/php").function("realpath_cache_add@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:641")

根据上面的输出结果,可以稍作改动就可以知道执行轨迹

# 方法开始执行的时候打印一个信息
probe process("/usr/local/anjuke-php-fpm/bin/php").function("tsrm_realpath_r") {
    printf("------------------ %d %s %s \n ",pid(),execname(), $$parms$);
}

# 将 function 改成 statement 就可以利用 pp() 方法,将 :641 改成 :* 就可以打印整个方法
probe process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:*") {
    printf("------------------ %d %s \n ",pid(),pp());
}

结果如下

------------------ 20432 php path="/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im/business/contract/IImBusinessService.php" start=1 len=89 ll=140733436955868 t=140733436955856 use_realpath=1 is_dir=1 link_is_dir=0
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:766")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:753")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:778")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:779")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:784")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:828")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:826")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:830")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:832")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1058")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1061")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1093")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1094")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1097")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1104")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1108")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:751")
 ------------------ 20432 php path="/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im/business/contract" start=1 len=80 ll=140733436955868 t=140733436955856 use_realpath=1 is_dir=1 link_is_dir=0
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:766")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:753")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:778")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:779")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:784")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:828")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:826")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:830")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:832")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1058")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1061")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1093")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1094")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1097")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1104")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1108")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:751")
 ------------------ 20432 php path="/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im/business" start=1 len=71 ll=140733436955868 t=140733436955856 use_realpath=1 is_dir=1 link_is_dir=0
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:766")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:753")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:778")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:779")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:784")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:828")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:826")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:830")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:832")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1058")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1061")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1093")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1094")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1097")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1104")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1108")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:751")
 ------------------ 20432 php path="/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat/im" start=1 len=68 ll=140733436955868 t=140733436955856 use_realpath=1 is_dir=1 link_is_dir=0
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:766")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:753")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:778")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:779")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:784")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:828")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:826")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:830")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:832")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1058")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1061")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1093")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1094")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1097")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1104")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1108")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:751")
 ------------------ 20432 php path="/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58/spat" start=1 len=63 ll=140733436955868 t=140733436955856 use_realpath=1 is_dir=1 link_is_dir=0
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:766")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:753")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:778")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:779")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:784")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:828")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:826")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:830")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:832")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1058")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1061")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1093")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1094")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1097")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1104")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1108")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:751")
 ------------------ 20432 php path="/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com/bj58" start=1 len=58 ll=140733436955868 t=140733436955856 use_realpath=1 is_dir=1 link_is_dir=0
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:766")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:753")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:778")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:779")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:784")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:828")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:826")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:830")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:832")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1058")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1061")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1093")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1094")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1097")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1104")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1108")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:751")
 ------------------ 20432 php path="/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com" start=1 len=54 ll=140733436955868 t=140733436955856 use_realpath=1 is_dir=1 link_is_dir=0
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:766")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:753")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:775")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:774")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:778")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:779")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:784")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:828")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:826")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:830")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:832")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:836")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:838")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:840")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:843")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:844")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1146")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1109")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1110")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1129")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1133")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1134")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1138")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1140")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1143")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1146")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1109")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1110")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1129")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1133")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1134")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1138")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1140")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1143")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1146")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1109")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1110")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1129")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1133")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1134")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1138")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1140")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1143")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1146")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1109")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1110")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1129")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1133")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1134")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1138")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1140")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1143")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1146")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1109")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1110")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1129")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1133")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1134")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1138")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1140")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1143")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1146")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1109")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1110")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1129")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1133")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1134")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1138")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1140")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1143")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1146")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1109")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1110")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1129")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1133")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1134")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1138")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1140")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1143")
 ------------------ 20432 process("/usr/local/anjuke-php-fpm/bin/php").statement("tsrm_realpath_r@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:1146")


这里面可以找到规律 ,可以看到前面几次递归 都是在 1108 行结束,最后一次 行号的顺序是 843,844,1146,1109


看看代码

1104             if (i - 1 <= start) {
1105                 j = start;
1106             } else {
1107                 /* some leading directories may be unaccessable */
1108                 j = tsrm_realpath_r(path, start, i-1, ll, t, save ? CWD_FILEPATH : use_realpath, 1, NULL TSRMLS_CC);
1109                 if (j > start) {
1110                     path[j++] = DEFAULT_SLASH;
1111                 }
1112             }

1108 果然是进行递归

 830         if (start && save && CWDG(realpath_cache_size_limit)) {
 831             /* cache lookup for absolute path */
 832             if (!*t) {
 833                 *t = time(0);
 834             }
 835             if ((bucket = realpath_cache_find(path, len, *t TSRMLS_CC)) != NULL) {
 836                 if (is_dir && !bucket->is_dir) {
 837                     /* not a directory */
 838                     return -1;
 839                 } else {
 840                     if (link_is_dir) {
 841                         *link_is_dir = bucket->is_dir;
 842                     }
 843                     memcpy(path, bucket->realpath, bucket->realpath_len + 1);
 844                     return bucket->realpath_len;
 845                 }
 846             }
 847         }

844 是递归的结束,也就是跳出了循环,注意看跳出循环是传递的参数 /home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com 对比上面 lstat ,最后一次也是这个目录。之所以在这个地方进行跳出循环,是因为 realpath_cache_find 方法返回非 NULL,看这个方法的名字就是查找缓存

2.3 realpath_cache

PHP 针对真实的 require_once 中之前检查的并且是真实的路径会做一个缓存,这个缓存是有大小和时间的限制,之所以在/home/wbsong/projects/v2/apfv2-demo/app-biz/lib/scfbiz/com 这这个地方停止是以为这个路径之前缓存过,它下面的路径还要检查的原因是因为缓存满了,放不下了。

realpath_cache_size_limit=16K,当路径很多的时候是非常容易达到的。

 641 static inline void realpath_cache_add(const char *path, int path_len, const char *realpath, int realpath_len, int is_dir, time_t t TSRMLS_DC) /* {{{ */
 642 {
 643     long size = sizeof(realpath_cache_bucket) + path_len + 1;
 644     int same = 1;
 645
 646     if (realpath_len != path_len ||
 647         memcmp(path, realpath, path_len) != 0) {
 648         size += realpath_len + 1;
 649         same = 0;
 650     }
 651
 652     if (CWDG(realpath_cache_size) + size <= CWDG(realpath_cache_size_limit)) {
 653         realpath_cache_bucket *bucket = malloc(size);
 654         unsigned long n;
 655
 656         if (bucket == NULL) {
 657             return;
 658         }
 659
 660 #ifdef PHP_WIN32
 661         bucket->key = realpath_cache_key(path, path_len TSRMLS_CC);
 662 #else
 663         bucket->key = realpath_cache_key(path, path_len);
 664 #endif
 665         bucket->path = (char*)bucket + sizeof(realpath_cache_bucket);
 666         memcpy(bucket->path, path, path_len+1);
 667         bucket->path_len = path_len;
 668         if (same) {
 669             bucket->realpath = bucket->path;
 670         } else {
 671             bucket->realpath = bucket->path + (path_len + 1);
 672             memcpy(bucket->realpath, realpath, realpath_len+1);
 673         }
 674         bucket->realpath_len = realpath_len;
 675         bucket->is_dir = is_dir;
 676 #ifdef PHP_WIN32
 677         bucket->is_rvalid   = 0;
 678         bucket->is_readable = 0;
 679         bucket->is_wvalid   = 0;
 680         bucket->is_writable = 0;
 681 #endif
 682         bucket->expires = t + CWDG(realpath_cache_ttl);
 683         n = bucket->key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0]));
 684         bucket->next = CWDG(realpath_cache)[n];
 685         CWDG(realpath_cache)[n] = bucket;
 686         CWDG(realpath_cache_size) += size;
 687     }
 688 }

可以通过 systemtap 验证我们刚才说的结论,我们可以验证某个 path 有没有走到 663 bucket->key = realpath_cache_key(path, path_len); 这里。首先我们需要知道realpath_cache_add 方法里面有多少埋点。要通过 2 次命令

wbsong@ubuntu-wbsong:~/data/src/php-5.5.25$ stap -L 'process("/usr/local/anjuke-php-fpm/bin/php").function("*")' |grep realpath_cache_add
process("/usr/local/anjuke-php-fpm/bin/php").function("realpath_cache_add@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:641")
wbsong@ubuntu-wbsong:~/data/src/php-5.5.25$
wbsong@ubuntu-wbsong:~/data/src/php-5.5.25$
wbsong@ubuntu-wbsong:~/data/src/php-5.5.25$ stap -L 'process("/usr/local/anjuke-php-fpm/bin/php").function("realpath_cache_add@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:*")'
process("/usr/local/anjuke-php-fpm/bin/php").function("realpath_cache_add@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:646")
process("/usr/local/anjuke-php-fpm/bin/php").function("realpath_cache_add@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:647") $size:long int $same:int $t:time_t $is_dir:int $realpath_len:int $realpath:char const* $path_len:int $path:char const*
process("/usr/local/anjuke-php-fpm/bin/php").function("realpath_cache_add@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:648") $size:long int $same:int $t:time_t $is_dir:int $realpath_len:int $realpath:char const* $path_len:int $path:char const*
process("/usr/local/anjuke-php-fpm/bin/php").function("realpath_cache_add@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:649") $size:long int $same:int $t:time_t $is_dir:int $realpath_len:int $realpath:char const* $path_len:int $path:char const*
process("/usr/local/anjuke-php-fpm/bin/php").function("realpath_cache_add@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:652") $size:long int $same:int $t:time_t $is_dir:int $realpath_len:int $realpath:char const* $path_len:int $path:char const*
process("/usr/local/anjuke-php-fpm/bin/php").function("realpath_cache_add@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:653") $size:long int $same:int $t:time_t $is_dir:int $realpath_len:int $realpath:char const* $path_len:int $path:char const*
process("/usr/local/anjuke-php-fpm/bin/php").function("realpath_cache_add@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:656") $size:long int $same:int $t:time_t $is_dir:int $realpath_len:int $realpath:char const* $path_len:int $path:char const*
process("/usr/local/anjuke-php-fpm/bin/php").function("realpath_cache_add@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:663") $bucket:realpath_cache_bucket* $size:long int $same:int $t:time_t $is_dir:int $realpath_len:int $realpath:char const* $path_len:int $path:char const*
process("/usr/local/anjuke-php-fpm/bin/php").function("realpath_cache_add@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:665") $bucket:realpath_cache_bucket* $size:long int $same:int $t:time_t $is_dir:int $realpath_len:int $realpath:char const* $path_len:int $path:char const*
process("/usr/local/anjuke-php-fpm/bin/php").function("realpath_cache_add@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:667") $bucket:realpath_cache_bucket* $size:long int $same:int $t:time_t $is_dir:int $realpath_len:int $realpath:char const* $path_len:int $path:char const*
process("/usr/local/anjuke-php-fpm/bin/php").function("realpath_cache_add@/root/php-5.5.25/TSRM/tsrm_virtual_cwd.c:668") $bucket:realpath_cache_bucket* $size:long int $same:int $t:time_t $is_dir:int $realpath_len:int $realpath:char const* $path_len:int $path:char const*
process
 类似资料: