warn about use of uninstalled kernel headers

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 <arnd@arndb.de>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
This commit is contained in:
Arnd Bergmann 2009-09-21 16:37:12 +02:00 committed by Sam Ravnborg
parent 17c5ca9883
commit c01226c314
2 changed files with 7 additions and 1 deletions

View file

@ -659,6 +659,12 @@ extern int do_sysinfo(struct sysinfo *info);
#endif /* __KERNEL__ */ #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 #define SI_LOAD_SHIFT 16
struct sysinfo { struct sysinfo {
long uptime; /* Seconds since boot */ long uptime; /* Seconds since boot */

View file

@ -20,7 +20,7 @@ use strict;
my ($readdir, $installdir, $arch, @files) = @ARGV; 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) { foreach my $file (@files) {
local *INFILE; local *INFILE;