public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Millan <zeratul2@wanadoo.es>
To: linux-kernel@vger.kernel.org
Subject: external (userland) inclussion of <linux/*.h>
Date: Sun, 5 Oct 2003 12:42:07 +0000	[thread overview]
Message-ID: <20031005124207.GA1254@aragorn> (raw)


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)

                 reply	other threads:[~2003-10-05 10:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20031005124207.GA1254@aragorn \
    --to=zeratul2@wanadoo.es \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox