zl程序教程

您现在的位置是:首页 >  系统

当前栏目

Linux 准确查找结构体定义位置

Linux 结构 定义 查找 位置 准确
2023-09-27 14:26:23 时间

例如:查找文件操作结构体 struct file_operations,

使用转移符 "\" 

$ grep struct\ file_operations\ { kernel/include/ -rn

使用双引号

$ grep "struct file_operations {" kernel/include/ -rn

 

下面这种方式,会查找到所有含有 file_operations 的结构体,包括定义,声明,使用。

$ grep file_operations kernel/include/ -rn

下面这种方式,只会匹配struct,所以含有struct的都会显示。

$ grep struct file_operations { kernel/include/ -rn