On Sat, Mar 03, 2007 at 08:09:47PM -0600, Robert Hancock wrote: > Date: Sat, 03 Mar 2007 20:09:47 -0600 > From: Robert Hancock <[EMAIL PROTECTED]> > Subject: Re: asm/atomic.h and user code > To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>, > linux-kernel <linux-kernel@vger.kernel.org> > Content-type: text/plain; charset=ISO-8859-1; format=flowed > > [EMAIL PROTECTED] wrote: > >Is it me or it seems it is not possible anymore to use asm/atomic.h in > >non-kernel code ? Thanks. > > The atomic functions, as with any internal kernel data structures, were > never intended to be used in userspace. In particular, the atomic > functions depend on config settings like CONFIG_SMP in order to actually > be atomic, and that's not guaranteed in userspace.
Some of the atomic headers use constructs such as disabling interrupts which are not permitted in user space and if they were, would _silently_ fail. Other atomic operations such as <asm/bitops.h>, <asm/spinlock.h> and xchg() <asm/system.h> have the same restriction. Another trap is that in userspace PIC code may be used while in the kernel it generally is not used and therefore much of the inline assembler code in the kernel might fail. In short, the kernel is a different universe :-) Ralf - 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/