kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: kernelnewbies@kernelnewbies.org
Subject: Re: internal / external include files
Date: Wed, 24 Jul 2019 11:21:33 +0200	[thread overview]
Message-ID: <20190724092133.GA6035@kroah.com> (raw)
In-Reply-To: <20190724091100.lcfw3y7nbcelvgrc@viti.kaiser.cx>

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@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  reply	other threads:[~2019-07-24  9:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-24  9:11 internal / external include files Martin Kaiser
2019-07-24  9:21 ` Greg KH [this message]
2019-07-24 21:20   ` Martin Kaiser
2019-07-25  5:45     ` Re[3]: " Konstantin Andreev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190724092133.GA6035@kroah.com \
    --to=greg@kroah.com \
    --cc=kernelnewbies@kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).