Re: [RFC] Splitting kernel headers and deprecating __KERNEL__

Arnd Bergmann
2004-11-28T12:10:18Z

[-- Attachment #1: Type: text/plain, Size: 2215 bytes --]

Ok, I've looked for places where someone actually tried using
the kernel headers by googling for /usr/include/asm/foo.h.
The good news is that marking these files broken in
glibc-kernheaders has already pointed most authors to the
source of the problem.

On Sünndag 28 November 2004 08:13, Arjan van de Ven wrote:
>
> > The problem with these (atomic.h
>
> that is a very non portable header and there are several good
> alternatives (see the apr library for example). In fact. atomic.h is
> *dangerous* in userspace, it is only atomic if CONFIG_SMP is set, so if
> you compile your app on a machine without that set and then run it on an
> smp machine, you are not atomic.

Yes, it appears that most people who attempted to use this
have already been bitten so hard that they stopped trying.

> >
> > , bitops.h
>
> again not portable

netbase-ping6 tried to use it, along with some other applications that
I had not heard of.

> >
> > , byteorder.h,
>
> there are perfectly good alternatives in glibc

Google found abuses of byteorder.h in kdeedu, dbootstrap and netatalk,
I would expect to find many more if I kept looking.

> >
> > div64.h,
>
> huh? what is wrong with "/" in C

Ok, probably nobody has tried to do funny things with this one.

> > list.h
>
> this one I can see

Surprisingly few abuses. It is already been protected with
#ifdef __KERNEL__ for some time.

> >
> > , spinlock.h
>
> EHHHH????? Spinlocks in userland? You got to be kidding.

I don't think it's that uncommon to use spinlocks in user
space, IIRC samba (tdb) and some databases implement their
own version of user spinlocks. The kernel implementation
is used at least in "Open Runtime Platform" and in "Chrony".
Chrony even has an FAQ entry on how to circumvent the
"#ifndef __KERNEL__" that was added in Red Hat Linux...

> > , unaligned.h
>
> weird

At least one application that I use every day (vdr) tried including
asm/unaligned.h, but it's rather uncommon otherwise.

> > and xor.h)
>
> xor.h is very raid specific (and GPL with lots of code, so a license
> trap)

Right, this one has never been used from user space AFAICS.

Arnd <><

[-- Attachment #2: signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]