Posix semaphore source location on Linux
I started to learn the concept of semaphores in the operating system. I am using POSIX semaphores on linux. I've used sem_init (), sem_wait () and sem_post () to initialize, decrement, and increment semaphore variables.
I've seen function declarations defined in the semaphore.h file.
But I couldn't find the source code for these functions. I went through some of the kernel source files but I couldn't find them. Where can I get these source files?
I am using linux 3.6.11-4 kernel.
Thank.
source to share
Unlike the older "SysV IPC" semaphores ( semctl
, semop
etc.), the POSIX semaphore API is not directly implemented in the kernel. Instead, the C library implements it on top of a futex
generic synchronization primitive.
The code you are looking for is in a subdirectory nptl
of the GNU libc source tree. You may also need to search in sysdeps
to find all of these.
source to share