简体   繁体   中英

Posix Semaphores source code location in linux

I have started learning semaphores concept in Operating System. I am using POSIX semaphores in linux. I have used sem_init(), sem_wait() and sem_post() for initializing, decrementing and incrementing semaphore variables.

I have seen Function declarations given in semaphore.h file.

But I couldn't find source code of these above functions. I have gone through some kernel source files but I couldn't find them. From where can I get these source code files?

I am using linux 3.6.11-4 kernel.

Thanks.

Unlike the older "SysV IPC" semaphores ( semctl , semop , etc), the POSIX semaphore API is not implemented directly by the kernel. Instead, the C library implements it on top of the futex generic synchronization primitive.

The code you are looking for is in the nptl subdirectory of the GNU libc source tree. You may also have to go digging around in sysdeps to find all of it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM