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