oddities regarding "#if[n]def __KERNEL__" and exporting headers to userspace

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

 



  over the last little while, i've submitted a number of patches
cleaning up the header files that are exported to userspace when
running "make headers_install".  as i'm sure you know, what gets
exported and whether that needs to be "sanitized" with unifdef is
listed in the respective "Kbuild" file in each headers directory.
but there are a couple things that confuse me about that.

  first, consider, say, the header file <linux/thread_info.h>, which
surrounds part of its contents with:

  #ifdef __KERNEL__
  ...
  #endif

fair enough ... until you notice that that header file is not listed
in Kbuild and is therefore never exported to userspace.  so what's the
value of protecting some of its contents with that preprocessor
directive if that header file never leaves kernel space?  it seems
sort of superfluous.

  also, the same can be said about, say, <linux/mount.h>, but *that*
header file has an even weirder property -- its *entire* contents are
wrapped in that #ifdef.  what's the point of *that*?  i would have
thought that the whole point of protecting some header file contents
is that *some* of it relevant for kernel space, and some *different*
part of it applies to user space.  but what's the point of surrounding
the entire contents in that kind of test?  doesn't that just mean that
you're going to export to userspace either all of or none of it?  and
wouldn't you more trivially control that through the Kbuild file
without any need for a preprocessor directive?

  thoughts?

rday
--

========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
    Have classroom, will lecture.

http://crashcourse.ca                          Waterloo, Ontario, CANADA
========================================================================

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[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