CÚdric Pillonel wrote:

>I try to compile a library using spinlocks. This library includes
>"linux/spinlock.h", but this file is empty:
>
>#ifndef __LINUX_SPINLOCK_H
>#define __LINUX_SPINLOCK_H
>
>#endif /* __LINUX_SPINLOCK_H */
>
>I have also taken a look at "asm/spinlock.h":
>
>#ifndef __ASM_SPINLOCK_H
>#define __ASM_SPINLOCK_H
>
>#warning Unportable code! This header does not exist on all architectures
>#warning Including kernel headers in userspace!
>#endif /* __ASM_SPINLOCK_H */
>
>Why are both of these files empty? Where is spin_lock() defined?
>I have RedHat 9, kernel 2.4.20-31.9, not the smp one, I have installed all
>RPMs. These files have been installed by the following package:
>glibc-kernheaders-2.4-8.10.
>
>Thank you.
>
>
>
>

Those spinlocks are used in the kernel - I don't think they are meant
for user-space. On non-smp kernels their implementation is empty on
purpose, for performance reasons. Read the paragraph "Another Digression
into Race Conditions" from
http://www.xml.com/ldd/chapter/book/ch05.html

Mihai