• 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>
     





  • 相关阅读:
    线程每隔5秒监控一次系统时间
    Struts2框架运行流程及案例
    list转为json
    Workbook读取Excel数据
    testng 接口测试,读取Excel表格数据,做数据驱动2(读取某些固定列数据)
    解析json数据,将json转为实体类
    通过maven命令将jar包放入本地仓库下
    遍历 Object[] [] 数组的值
    testng 接口测试,读取Excel表格数据,做数据驱动1(按照顺序读取Excel数据)
    解析json数据,将json转为Map
  • 原文地址:https://www.cnblogs.com/lshs/p/6113065.html
Copyright © 2020-2023  润新知