Re: Illegal use of reserved word in system.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On May 18, 2005, at 15:53:37, Adrian Bunk wrote:
Looking at the source code of MySQL, it seems MySQL does some dirty
tricks for using the inlines from asm/atomic.h in userspace.

It's _really_ wrong to do this.

A project that had some discussion a while ago was to clean up the
kernel headers and separate them from the kernel-ABI ones, such that
the ABI headers don't need to use CONFIG_* defines or anything else.
that might be iffy.

I suppose a related project would be to build a generic architecture
library (How about "libarch"?) that has a clean set of headers and
context-independent functions  (ASM memset, ASM memmove, etc), with
the ability to be used directly in userspace or kernelspace, and
exported via a vDSO to userspace for applications that want it.  It
could share the same memory pages between the kernel and userspace,
and with the appropriate config options, it could provide locking
and memory routines optimized for the particular architecture.

I realize that locking routines for some architectures would need to
be implemented by a libc via kernel calls, as the requisite opcodes
are unavailable under usermode, but that could easily be handled by
a wrapper library, as long as the kernel-supported functions and
inlines are provided cleanly and without clutter.  The simplistic
__KERNEL__ define could just switch between privileged-opcode inlines
and unprivileged ones, including undefining them entirely and telling
the wrapper libc headers to implement them with syscalls.

This would be a major project, but I think it would make life a lot
easier for application developers.  I also think that this library
would need to be licensed under the GPL, due to the existing license
on the kernel code that would be copied, but it _might_ be useable
from proprietary applications  (NOTE: IANAL, and I certainly don't
claim to speak for the kernel community at large, so YMMV and you may
well get sued for such usage, but it would still be very useful in
low-latency GPL'ed software that needs atomic ops and spinlocks, and
could be used for more if we threw in the linked list implementation
and other completely arch-agnostic code.)

Cheers,
Kyle Moffett

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCM/CS/IT/U d- s++: a18 C++++>$ UB/L/X/*++++(+)>$ P+++(++++)>$
L++++(+++) E W++(+) N+++(++) o? K? w--- O? M++ V? PS+() PE+(-) Y+
PGP+++ t+(+++) 5 X R? tv-(--) b++++(++) DI+ D+ G e->++++$ h!*()>++$ r !y?(-)
------END GEEK CODE BLOCK------

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux