epoll&ext4文件系统

1、第一个终端运行nesttest,nesttest首先fork一个子进程,然后父进程退出,子进程首先打开一个txt普通文件对应fd为3,然后创建一个epfd,对应fd为4

  1. lybxin@Inspiron:~/MyRes/LNP/tcp/epolltest$./nesttest&
  2. [1]29274
  3. lybxin@Inspiron:~/MyRes/LNP/tcp/epolltest$-----------test10 EPOLLONESHOT epfd:4,fd:3-----------
  4. [1]+  退出91               ./nesttest
  5. lybxin@Inspiron:~/MyRes/LNP/tcp/epolltest$ps -aux | grep nest
  6. lybxin   29074  3.1  1.267875248692?        Sl   14:41   0:13 gedit /home/lybxin/MyRes/LNP/tcp/epolltest/nesttest.c
  7. lybxin   29275  0.0  0.0   4364    84 pts/12   S    14:48   0:00./nesttest
  8. lybxin   29277  0.0  0.0  15984   928 pts/12   S+   14:48   0:00 grep --color=auto nest
  9. lybxin@Inspiron:~/MyRes/LNP/tcp/epolltest$cat /proc/29275/task/29275/fdinfo/3
  10. pos:0
  11. flags:0100002
  12. mnt_id:24
  13. lybxin@Inspiron:~/MyRes/LNP/tcp/epolltest$cat /proc/29275/task/29275/fdinfo/4
  14. pos:0
  15. flags:02
  16. mnt_id:11

2、使用crash分析上面进程对应的文件信息

  1. crash> task files 29275
  2. PID:29275  TASK: ffff88006be71900  CPU:2   COMMAND:"nesttest"
  3.  files =0xffff88009ee44840,
  4. crash> struct files_struct.fd_array 0xffff88009ee44840
  5.  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}
  6. crash> struct file.f_op 0xffff880081428c00
  7.  f_op =0xffffffff81a33a40<ext4_file_operations>
  8. crash> struct file_operations.poll 0xffffffff81a33a40
  9.  poll =0x0
  10. crash> struct file.f_op 0xffff8800b94a5400
  11.  f_op =0xffffffff81a2ae00<eventpoll_fops>
  12. crash> struct file_operations.poll 0xffffffff81a2ae00
  13.  poll =0xffffffff81254ec0<ep_eventpoll_poll>
 





原文地址:https://www.cnblogs.com/lshs/p/6113065.html