public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* external (userland) inclussion of <linux/*.h>
@ 2003-10-05 12:42 Robert Millan
  0 siblings, 0 replies; only message in thread
From: Robert Millan @ 2003-10-05 12:42 UTC (permalink / raw)
  To: linux-kernel


Hi there,

It is well known that Linux headers, which distributors put in /usr/include
in order to be used by Glibc, are often abused and mistakenly included by
userspace programs that don't actualy need kernel-specific features.

For example, some programmers prefer to include <linux/limits.h> instead of
<limits.h> to get a limit macro and break for all non-Linux-based systems while
they are at it.

When including a header directly is a wrong thing, the general tendency is to
simply disallow it. For example, Glibc headers use preprocessor commands in
the style of:

  #ifndef _STDIO_H
  # error "Never include <bits/stdio.h> directly; use <stdio.h> instead."
  #endif

Since there are a few legitimate uses of <linux/*.h> for userspace programs,
one could allow such by using the proper macro, something like:

  #ifndef _LINUX_SOURCE
  # error "blah"
  #endif

If you like the idea, I can send a patch for all this.

-- 
Robert Millan

"[..] but the delight and pride of Aule is in the deed of making, and in the
thing made, and neither in possession nor in his own mastery; wherefore he
gives and hoards not, and is free from care, passing ever on to some new work."

 -- J.R.R.T, Ainulindale (Silmarillion)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-10-05 10:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-05 12:42 external (userland) inclussion of <linux/*.h> Robert Millan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox