kernel headers & userland

From: Abraham vd Merwe (abraham@2d3d.co.za)
Date: Mon Aug 06 2001 - 02:56:38 EST


Hi!

Apparently Linus told Felix von Leitner (the author of dietlibc - a small,
no nonsense glibc replacement C library) a while ago _not_ to include any
linux kernel headers in userland (i.e. the C library headers in this case).

This imho is obviously wrong since there are definitely a need for including
kernel headers on a linux platform.

Just the basic stuff for instance:

keyboard: sys/kd.h - needs linux/kd.h
sound: sys/soundcard.h - need linux/soundcard.h
sysctl: sys/sysctl.h - need linux/sysctl.h
vt: sys/vt.h - need linux/vt.h

and so on. Then there's the whole sys/types.h issue which needs
linux/types.h, etc.

Even if you go through the trouble of making a generic sys/types.h and
carefully avoid kernel headers by not defining things like sys/soundcard.h
at all (boy, is this going to break things), you are going to run into lots
of trouble when applications include kernel headers on their own and your
headers (duplicate type definitions - you can hack this that linux kernel
headers override this, but it's a nightmare to manage).

Now, you may argue that userland apps should not include linux kernel
headers either, but sometimes it does. Just look at all userland apps that
needs to interface with kernel subsystems such as v4l, mtd, oss, etc.

Then there's all the ioctl() definitions (e.g. ioctl()'s for ext2, keyboard
leds, etc.)

In short, there is simply too many things that will break if you don't
include linux kernel headers in the C library headers (just look at glibc
for instance).

-- 

Regards Abraham

Iron Law of Distribution: Them that has, gets.

__________________________________________________________ Abraham vd Merwe - 2d3D, Inc.

Device Driver Development, Outsourcing, Embedded Systems

Cell: +27 82 565 4451 Snailmail: Tel: +27 21 761 7549 Block C, Antree Park Fax: +27 21 761 7648 Doncaster Road Email: abraham@2d3d.co.za Kenilworth, 7700 Http: http://www.2d3d.com South Africa


- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Aug 07 2001 - 21:00:37 EST