Re: [PATCH] C++ breaks on linux/ioport.h

From: Jes Sorensen (Jes.Sorensen@cern.ch)
Date: Fri Apr 28 2000 - 04:45:57 EST


>>>>> "Tigran" == Tigran Aivazian <tigran@veritas.com> writes:

Tigran> On Thu, 27 Apr 2000, Paul Barton-Davis wrote:
>> >From: Jes Sorensen <Jes.Sorensen@cern.ch>
>>
>> >Thats pretty irrelevant, you are not supposed to include the
>> kernel >headers in C++ programs.
>>
>> I find this approach pretty worrying. Its *often* necessary to
>> include such files in user-space programs that use ioctl to control
>> various hardware resourcs (e.g. linux/rtc.h).

Tigran> hey, I am sure Jes was joking, just forgot to put a smiley
Tigran> there :)

Tigran> Of course, one can include anything he likes anywhere he likes
Tigran> - but to prevent compilation failures the headers protect some
Tigran> stuff with __KERNEL__ and if the program *really* wants to
Tigran> access that stuff (e.g. some readers of /dev/kmem etc.) they
Tigran> can define __KERNEL__ and then deal with the problems
Tigran> internally, i.e. it becomes app programmer's problem to
Tigran> arrange the headers correctly and not a kernel header writer's
Tigran> problem.

Ok let me elaborate:

I first read the posting as someone trying to compile a kernel module
with C++ - that is borken and should not be done.

In general one should avoid going directly for the kernel headers from
userland and go via glibc. However there are corner cases where you
need to access certain bits from userland, these bits should of course
be properly marked so the bits the user don't see are surrounded by
__KERNEL__.

Jes

PS: Having C++ go away for good as a whole would of course be nice,
but thats a totally different discussion that does *not* belong on the
kernel mailing list.

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



This archive was generated by hypermail 2b29 : Sun Apr 30 2000 - 21:00:14 EST