On a freshly installed Ubuntu , i found kernel headers in both /usr/include/linux , and /usr/src/kernel-version-headers/include/linux
Are they mutually the same ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
They are very different; the
/usr/include/linuxheaders 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/linuxheaders are used via the/lib/modules/$(uname -r)/buildsymbolic links. They are owned by the kernel headers packages and updated in lockstep with the kernel. These are a subset of the kernel headers and enough of the Kbuild system required to build out-of-tree kernel modules. These files represent the kernel internals — modules must build against these if they are to properly understand in-memory objects. See the kernel’sDocumentation/kbuild/modules.txtfile for some details.1: “Mediated” was my first word choice, but it implies some sort of access controls, which isn’t the case. “Brokered” implies a third-party process, but that is also not the case. Consider: when a C program calls
_exit(), it is actually calling the Standard C library’s_exit()wrapper, which calls theexit(2)system call. Theselect(2)interface has an upper limit on the number of file descriptors that can be tracked, and that limit is compiled into the standard C library. Even if the kernel’s interface were extended, the C library would also need to be recompiled.