想要查看一些结构体的定义,比如struct ip_mreq,可以查看头文件,所有的系统预定义的结构体都在内核源代码的/include下有定义,ubuntu里面是/usr/include 。 比如要找上面提到的struct ip_mreq,可以这样:find /usr/include -name "*.h" | xargs grep "struct ip_mreq" -rn ,结果显示,这个结构体在/usr/include/netinet/in.h 的251行有定义。 其他的情况举一反三即可。
如何在内核里面查找某些结构体或者宏的定义
原创ahuoheng 博主文章分类:LINUX/UNIX ©著作权
©著作权归作者所有:来自51CTO博客作者ahuoheng的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
结构体大小计算-结构体对齐
计算某一结构体大小:方法以及规则。
偏移量 #pragma 结构体 结构体大小计算