/usr/include/linux 和 Linux 内核源代码中的 include 文件夹有什么区别?

2024-01-03

在新安装的 Ubuntu 上,我在两个文件中都找到了内核头文件/usr/include/linux , and /usr/src/kernel-version-headers/include/linux

它们彼此相同吗?


They are very different; the /usr/include/linux headers are the headers that were used when compiling the system's standard C library. They are owned by the C library packaging, and updated in lockstep with the standard C library. They exist to provide the userland interface to the kernel, as understood and "brokered"1 by the C library.

The /usr/src/linux-headers-$(uname -r)/include/linux标头通过以下方式使用/lib/modules/$(uname -r)/build符号链接。它们由内核头文件包所有,并与内核同步更新。这些是一个subset构建树外内核模块所需的内核头文件和足够的 Kbuild 系统。这些文件代表内核内部结构-- 如果模块要正确理解内存中的对象,则必须针对这些模块进行构建。查看内核的Documentation/kbuild/modules.txt文件以获取一些详细信息。


1:“中介”是我的第一个词选择,但它意味着某种访问控制,但事实并非如此。 “中介”意味着第三方流程,但事实也并非如此。考虑:当 C 程序调用_exit(),它实际上是调用标准C库的_exit() wrapper,这称为exit(2)系统调用。这select(2)接口对可跟踪的文件描述符的数量有上限,并且该限制被编译到标准 C 库中。即使扩展了内核的接口,C库也需要重新编译。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

/usr/include/linux 和 Linux 内核源代码中的 include 文件夹有什么区别? 的相关文章

随机推荐