From: Arnd Bergmann Date: Mon, 21 Sep 2009 14:37:12 +0000 (+0200) Subject: warn about use of uninstalled kernel headers X-Git-Tag: v3.0~7185^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c01226c3145d173a0d38f9d5b4f229cc23d99ae2;p=platform%2Fkernel%2Flinux-amlogic.git 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 Signed-off-by: Sam Ravnborg --- diff --git a/include/linux/kernel.h b/include/linux/kernel.h index d3cd23f..f4e3184 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -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 */ diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl index c6ae405..b89ca2c 100644 --- a/scripts/headers_install.pl +++ b/scripts/headers_install.pl @@ -20,7 +20,7 @@ use strict; 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;