public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Werner Almesberger <Werner.Almesberger@epfl.ch>
To: Alexander Viro <viro@math.psu.edu>
Cc: LA Walsh <law@sgi.com>, lkml <linux-kernel@vger.kernel.org>
Subject: Re: Linus's include file strategy redux
Date: Fri, 15 Dec 2000 15:21:37 +0100	[thread overview]
Message-ID: <20001215152137.K599@almesberger.net> (raw)
In-Reply-To: <NBBBJGOOMDFADJDGDCPHIENJCJAA.law@sgi.com> <Pine.GSO.4.21.0012141900140.10441-100000@weyl.math.psu.edu>
In-Reply-To: <Pine.GSO.4.21.0012141900140.10441-100000@weyl.math.psu.edu>; from viro@math.psu.edu on Thu, Dec 14, 2000 at 07:15:23PM -0500

Alexander Viro wrote:
> In the situation above they should have -I<wherever_the_tree_lives>/include
> in CFLAGS. Always had to. No links, no pain in ass, no interference with
> userland compiles.

As long as there's a standard location for "<wherever_the_tree_lives>",
this is fine. In most cases, the tree one expects to find is "roughly
the kernel we're running". Actually, maybe a script to provide the
path would be even better (*). Such a script could also complain if
there's an obvious problem.

I think there are three possible directions wrt visibility of kernel
headers:

 - non at all - anything that needs kernel headers needs to provide them
   itself
 - kernel-specific extentions only; libc is self-contained, but user
   space can get items from .../include/linux (the current glibc
   approach)
 - share as much as possible; libc relies on kernel for "standard"
   definitions (the libc5 approach, and also reasonably feasible
   today)

My personal preference is the third direction, because it simplifies the
deployment of new "standard" elements, and changes to existing interfaces.
The first direction would effectively discourage any new interfaces or
changes to existing ones, while the second direction allows at least a
moderate amount of flexibility for kernel-specific interfaces. In my
experiments with newlib, I was largely able to use the third approach.

I don't want to re-open the discussion on which way is better for glibc,
but I think we can agree that "clean" kernel headers are always a good
idea.

So we get at least the following levels of visibility:

 0) kernel-internal interfaces; should only be visible to "base" kernel
 1) public kernel interfaces; should be visible to modules (exposing
    type 0 interfaces to modules may create ways to undermine the GPL)
 2) interfaces to kernel-specific user space tools (modutils, mount,
    etc.); should be visible to user space that really wants them
 3) interface to common non-POSIX extensions (BSD system calls, etc.);
    should be visible to user space on request, or on an opt-out basis
 4) interfaces to POSIX elements (e.g. struct stat, mode_t); should be
    visible unconditionally (**)

Distinguishing level 0 and 1 is always a little difficult. It seems
that a "kmodcc" that inserts the necessary flags would be useful there
(*). There needs to be a clear distinction between level 1 and 2 (the
current #ifdef __KERNEL__). This boundary could certainly be improved
be moving user-space-visible header files to a separate directory.

Levels 2, 3, and 4 are more difficult to separate, because the people
who know what should go where are not always the ones writing the
kernel headers. Perhaps some more input from libc hackers could help.

(*) Crude examples for such scripts (for newlib): newlib-flags and
    newlib-cc in
    ftp://icaftp.epfl.ch/pub/people/almesber/misc/newlib-linux/
      newlib-linux-20.tar.gz

(**) Multiple versions of the interface can be a problem here, e.g.
     struct oldold_utsname vs. struct old_utsname vs.
     struct new_utsname. It would be nice to have them prefixed at
     least with __. Maybe a __LATEST_utsname macro would be useful
     too ;-) (I know, breaks binary compatibility, hence the
     smiley.)

So ... what's the opinion on slowly introducing a redirection via
scripts ?

- Werner

-- 
  _________________________________________________________________________
 / Werner Almesberger, ICA, EPFL, CH           Werner.Almesberger@epfl.ch /
/_IN_N_032__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  parent reply	other threads:[~2000-12-15 14:52 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <91gr99$bs81o$1@fido.engr.sgi.com>
2000-12-14 23:55 ` Linus's include file strategy redux LA Walsh
2000-12-15  0:14   ` Miquel van Smoorenburg
2000-12-15  0:17     ` Alexander Viro
2000-12-15  0:39       ` Miquel van Smoorenburg
2000-12-15  0:33     ` Alan Cox
2000-12-15  0:48       ` Alexander Viro
2000-12-15  0:56         ` David Riley
2000-12-15  1:05           ` Alexander Viro
2000-12-15  4:24             ` ferret
2000-12-16 11:30       ` Marcus Sundberg
2000-12-15 14:57     ` Kurt Roeckx
2000-12-15 15:23       ` Dana Lacoste
2000-12-15 22:28         ` Alex Buell
2000-12-16 22:41         ` Peter Samuelson
2000-12-18 15:51           ` Dana Lacoste
2000-12-18 17:08             ` Peter Samuelson
2000-12-18 19:32             ` David Schleef
2000-12-18 17:04         ` richard offer
2000-12-19  5:16           ` Peter Samuelson
2000-12-15  0:15   ` Alexander Viro
2000-12-15  7:21     ` LA Walsh
2000-12-15 11:05       ` Chmouel Boudjnah
2000-12-15 14:21     ` Werner Almesberger [this message]
2000-12-15 17:15       ` ferret
2000-12-15 17:46         ` Werner Almesberger
2000-12-15 20:29           ` Joe deBlaquiere
2000-12-15 21:27             ` Werner Almesberger
2000-12-15 22:58               ` Joe deBlaquiere
2000-12-15 23:56                 ` Werner Almesberger
2000-12-16 22:50                 ` Peter Samuelson
2000-12-17  0:04                   ` Joe deBlaquiere
2000-12-17  2:05                     ` Peter Samuelson
2000-12-15 18:10       ` LA Walsh
2000-12-15 21:02         ` Miquel van Smoorenburg
2000-12-16  4:04           ` ferret
2000-12-16 11:09             ` Miquel van Smoorenburg
2000-12-16 17:20               ` ferret
2000-12-17  0:21                 ` J . A . Magallon
2000-12-16 23:10           ` Peter Samuelson
2000-12-17  1:15             ` Miquel van Smoorenburg
2000-12-17  2:18               ` Peter Samuelson
2000-12-15 21:21         ` Werner Almesberger
2000-12-15 21:36           ` LA Walsh
2000-12-15 22:48           ` J . A . Magallon
2000-12-15 23:47             ` Werner Almesberger
2000-12-16  4:11             ` ferret
2000-12-16  2:50         ` richard offer
2000-12-16  4:22           ` What about 'kernel package'? was: " ferret
2000-12-15 19:35       ` Matt D. Robinson
2000-12-15 21:36         ` Werner Almesberger
2000-12-18 17:48 Petr Vandrovec

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=20001215152137.K599@almesberger.net \
    --to=werner.almesberger@epfl.ch \
    --cc=law@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@math.psu.edu \
    /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