there's something i've been curious about for a while regarding semaphores. in robert love's kernel book (2005, so it's a bit out of date and that might be an issue here), he's writing about semaphores and says that statically declared semaphores can be declared with: static DECLARE_SEMAPHORE_GENERIC(name, count); sounds reasonable, but if you look in include/asm-i386/semaphore.h these days, what you see is: #define __DECLARE_SEMAPHORE_GENERIC(name,count) \ struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) so that macro has clearly been renamed, and *appears* to be treated as the fundamental, underlying mechanism for creating a new semaphore. in fact, it's used by: #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) #define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0) it's as if, as a kernel programmer, you're not really supposed to call __DECLARE_SEMAPHORE_GENERIC() directly anymore and, in fact, no one does. everyone seems to declare an actual "struct semaphore", and use "sema_init()" to initialize it. ok, fair enough. but look at the case of read-write semaphores now. if you look at include/asm-i386/rwsem.h, it has the corresponding macro: #define DECLARE_RWSEM(name) \ struct rw_semaphore name = __RWSEM_INITIALIZER(name) and if you do a search: $ grep -rw DECLARE_RWSEM . you can see that people *are* invoking that directly fairly frequently. so why the different treatment? apparently, if it comes to declaring a regular semaphore with something like DECLARE_SEMAPHORE, that's just not done. but invoking DECLARE_RWSEM appears to be fine. why the apparent inconsistency? rday -- ======================================================================== Robert P. J. Day Linux Consulting, Training and Annoying Kernel Pedantry Waterloo, Ontario, CANADA http://www.fsdev.dreamhosters.com/wiki/index.php?title=Main_Page ======================================================================== -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/