epoll&ext4文件系统
1、第一个终端运行nesttest,nesttest首先fork一个子进程,然后父进程退出,子进程首先打开一个txt普通文件对应fd为3,然后创建一个epfd,对应fd为4
lybxin@Inspiron:~/MyRes/LNP/tcp/epolltest$./nesttest&[1]29274lybxin@Inspiron:~/MyRes/LNP/tcp/epolltest$-----------test10 EPOLLONESHOT epfd:4,fd:3-----------[1]+ 退出91 ./nesttestlybxin@Inspiron:~/MyRes/LNP/tcp/epolltest$ps -aux | grep nestlybxin 29074 3.1 1.267875248692? Sl 14:41 0:13 gedit /home/lybxin/MyRes/LNP/tcp/epolltest/nesttest.clybxin 29275 0.0 0.0 4364 84 pts/12 S 14:48 0:00./nesttestlybxin 29277 0.0 0.0 15984 928 pts/12 S+ 14:48 0:00 grep --color=auto nestlybxin@Inspiron:~/MyRes/LNP/tcp/epolltest$cat /proc/29275/task/29275/fdinfo/3pos:0flags:0100002mnt_id:24lybxin@Inspiron:~/MyRes/LNP/tcp/epolltest$cat /proc/29275/task/29275/fdinfo/4pos:0flags:02mnt_id:11
2、使用crash分析上面进程对应的文件信息
crash> task files 29275PID:29275 TASK: ffff88006be71900 CPU:2 COMMAND:"nesttest"files =0xffff88009ee44840,crash> struct files_struct.fd_array 0xffff88009ee44840fd_array ={0xffff880033843200,0xffff880033843200,0xffff880033843200,0xffff880081428c00,0xffff8800b94a5400,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}crash> struct file.f_op 0xffff880081428c00f_op =0xffffffff81a33a40<ext4_file_operations>crash> struct file_operations.poll 0xffffffff81a33a40poll =0x0crash> struct file.f_op 0xffff8800b94a5400f_op =0xffffffff81a2ae00<eventpoll_fops>crash> struct file_operations.poll 0xffffffff81a2ae00poll =0xffffffff81254ec0<ep_eventpoll_poll>

浙公网安备 33010602011771号