Re: internal / external include files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 24, 2019 at 11:11:00AM +0200, Martin Kaiser wrote:
> Dear all,
> 
> is it correct that the files under include/uapi/ can be included by a
> user space application?

Yes.

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

That's odd, what did you ask to be included that caused that?

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

What kernel version did this happen for?

> 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?

The system stddef.h should always be used "first".

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

There should no longer be any need for that.

thanks,

greg k-h

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux