internal / external include files

Martin Kaiser lists at
Wed Jul 24 05:11:00 EDT 2019

Dear all,

is it correct that the files under include/uapi/ can be included by a
user space application?

I just ran into an error where my application ended up including
include/uapi/linux/stddef.h (with a number of intermediate steps).

This fails because the kernel's stddef.h includes
include/linux/compiler_types.h and this file is internal to
the kernel.

What is the correct way to solve this? Should I fix my include path to
make sure that my application picks the stddef.h in the compiler's
sysroot rather than the kernel's stddef.h?

Or should include/uapi/linux/stddef.h guard the kernel-internal parts
using #ifdef __KERNEL__?


More information about the Kernelnewbies mailing list