Skip to content

Commit

Permalink
warn about use of uninstalled kernel headers
Browse files Browse the repository at this point in the history
User applications frequently hit problems when they try to use
the kernel headers directly, rather than the exported headers.

This adds an explicit warning for this case, and points to
a URL holding an explanation of why this is wrong and what
to do about it.

Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>
  • Loading branch information
arndb authored and sravnborg committed Oct 11, 2009
1 parent 17c5ca9 commit c01226c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions include/linux/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,12 @@ extern int do_sysinfo(struct sysinfo *info);

#endif /* __KERNEL__ */

#ifndef __EXPORTED_HEADERS__
#ifndef __KERNEL__
#warning Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders
#endif /* __KERNEL__ */
#endif /* __EXPORTED_HEADERS__ */

#define SI_LOAD_SHIFT 16
struct sysinfo {
long uptime; /* Seconds since boot */
Expand Down
2 changes: 1 addition & 1 deletion scripts/headers_install.pl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

my ($readdir, $installdir, $arch, @files) = @ARGV;

my $unifdef = "scripts/unifdef -U__KERNEL__";
my $unifdef = "scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__";

foreach my $file (@files) {
local *INFILE;
Expand Down

0 comments on commit c01226c

Please sign in to comment.