Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 1
    With common headers you mean, that the common headers are used independent of the architecture and as soon as there is a variation in the header, this header is deleted and ported to each and every architecture? I am saying delete, because, I could not find any symbolic links between the include and arch. So, how does the kernel find the includes related to the arch? Understood your answer regarding userspace, but my query about the structure of header files remains open. Commented Mar 23, 2017 at 17:43
  • 1
    When variations occur, those variations would be isolated in arch-specific headers; it would be unusual for a header to be deleted entirely. There are no symlinks between include and arch; the appropriate arch-specific header paths are added to the compiler’s include path. (So you just use e.g. #include <asm/tce.h>, even though that’s arch-specific.) I’ll add this to my answer and try to expand it to address your question on the structure a bit more, but the latter is rather broad. Commented Mar 23, 2017 at 19:44
  • Could it be possible that a include file of the same name is present under both /include as well as /arch? Coz it might raise a conflict. Commented Sep 6, 2018 at 10:14
  • 1
    Include files of the same name are present under linux/include and arch, but they don’t create conflicts because all the arch headers are in paths which don’t appear under linux/include (asm or uapi, so you need to say #include <asm/compat.h> for example to include the arch-specific version). As mentioned in the answer, when writing kernel code, you normally only include files which are linux/include, and those files take care of including arch-specific versions as appropriate. Commented Sep 6, 2018 at 11:05