举个例子:在我的系统(Ubuntu 10.04)上,sockaddr 结构在/bits/sockaddr.h 中定义为
struct sockaddr{
_SOCKADDR_COMMON (sa_); /*...*/
char sa_data[14]; /*...*/
};
与 sockaddr_in 类似,第一个字段名为 sin_。
但是,我看到的所有例子都访问了字段sin_
structure_name.sin_family
我打算追踪 typedef (?) 的完整性,然后是包含的 header 等,但失败了(我找到了 sa_family_t 和类似的)。
作为一个更普遍的问题:比方说,是否有一个可搜索的在线资源,您可以在其中简单地搜索头文件中宏或 typedef 的位置——对于特定的 Ubuntu 发行版,或者更笼统地说,对于“典型的”Linux安装?或者,很明显,这是 Ubuntu 外壳中的一种巧妙方法;或一些关于如何更有效地执行此操作的任何其他想法的描述。
最佳答案
这是链接:
完成...稍后我会为您提供 Linux 内核 API 浏览器的引用资料(过去可以在某个地方在线找到它)。有 Linux Kernel Archives对于实际的源代码,您可能无论如何都可以从中生成文档。
Sorry, but I've not come across something as beautiful as say, the jQuery API Browser. Hopefully the 'Ubuntu Manpage' @ manpages.ubuntu.com/manpages/lucid/man7/netdevice.7.html, for example, might suffice. Also for stuff like the struct sockaddr{, you might like to check out the Linux Kernel API Browser (or something similar) as that belongs to standard Linux networking protocol headers.
关于c - 浏览标题定义的有效方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7278261/