Re: why do some header files check for ! __KERNEL__

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

 



Hi List,

Robert P. J. Day <rpjday <at> crashcourse.ca> writes:
> 
> 
>   i'm curious about the fact that a small number of header files that
> are exported to user space have preprocessor checks for *not* defined
> __KERNEL__, as in:
> 
> linux/acct.h:#if !defined(CONFIG_M68K) || !defined(__KERNEL__)
> video/edid.h:#if !defined(__KERNEL__) || defined(CONFIG_X86)
> 
>   it's obvious that the purpose of the check "#ifdef __KERNEL__" is to
> prevent some header file content from being exposed to user space.
> but to check for the opposite just strikes me as kind of weird -- it's
> saying that there's some content that *shouldn't* be in kernel space,
> but should be available in user space, and i don't see why the kernel
> should be defining that kind of content.
> 
>   any rationale for this sort of thing?  thanks.

I am not sure whether I am right - but I was wondering what would happen in case
of 32 bit libraries working on 64bit Kernel - You don't want kernel to look at a
header file containing some 32bit defines. But that is exactly what the user
space wants: 32bit defines hidden from a 64bit kernel.
if !__KERNEL__ would make sure that user-space gets what kernel should not.

I don't have an example of a such a scenario, so possible this is more of a
blind-shot.

THanks and apologies if that is misleading/wrong.
Shreyansh


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