如何在内核里面查找某些结构体或者宏的定义

想要查看一些结构体的定义,比如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行有定义。   其他的情况举一反三即可。 
原文地址:https://www.cnblogs.com/ahuo/p/2608463.html