In Linux, how can I get the filename from the “struct file” structure, while stepping thru the kernel with kgdb?

后端 未结 3 1096
你的背包
你的背包 2020-12-17 00:06

I\'m trying to view the filename via kgdb, so I cannot call functions and macros to get it programatically. I need to find it by manually inspecting data structures.

<
3条回答
  •  时光取名叫无心
    2020-12-17 00:41

    In the Linux kernel, the file structure is essentially how the kernel "sees" the file. The kernel is not interested in the file name, just the inode of the open file. This means that all of the other information which is important to the user is lost.


    EDIT: This answer is wrong. You can get the dentry using filp->f_path.dentry. From there you can get the name of the dentry or the full path using the relevant FS flags.

提交回复
热议问题