kernel headers

Matthias Benkmann matthias at
Fri Sep 6 06:14:09 PDT 2002

On Fri, 06 Sep 2002 07:22:41 -0400 Richard <rkm at> wrote:

> <linux/kernel.h>
> <linux/module.h>
> <linux/modversions.h>
> I assumed that these header files should be in the directory
> /usr/include/linux, 

Kernel modules are supposed to be built as part of the kernel, so these
includes refer to the kernel tree's include directory (e.g.
/usr/src/linux/include). /usr/include/linux carries system wide headers
used by glibc and ONLY glibc stuff should ever include these headers under
normal circumstances. 
A kernel module MUST NEVER use the includes from /usr/include/linux. Think
about it for a moment. The system could have been compiled with a 2.2
kernel, running a glibc built using the 2.2 headers. But the kernel
currently in use on the system need not be a 2.2 version. The system could
be running a 2.5 kernel and if you're compiling a 2.5 kernel module you
really don't want to compile using 2.2 kernel headers.
The same example also illustrates why linking /usr/include/linux to
/usr/src/linux/include/linux is a bad idea (unless you never ever touch
/usr/src/linux again).
The example also shows why a program using (i.e. relying on its contents
rather than its pure existence) autoconf.h from /usr/include/linux is
broken and needs to be fixed. It is kernel specific and there's no
guarantee it contains useful information relating to the running kernel.


God is real, unless declared integer.

Unsubscribe: send email to listar at
and put 'unsubscribe lfs-dev' in the subject header of the message

More information about the lfs-dev mailing list