As an aside...
#define __KERNEL__ #include <asm/atomic.h>
You don't want to do this, the stuff in the header files bracketed with __KERNEL__ is for internal use in the Linux kernel only; with newer kernel versions, that stuff isn't copied into the user headers anymore even. You can of course copy that code into your own code, or perhaps glibc has similar functionality somewhere? Segher