# IPC: where sem_open() places object name in the actual filesystem



## ivand58 (Jun 8, 2011)

Hi all, 

It is about IPC - where sem_open() maps its object name in the actual filesystem? I need this to list all semaphores.


----------



## SirDice (Jun 8, 2011)

Semaphores aren't stored on a filesystem.


----------



## expl (Jun 8, 2011)

Semaphores are file descriptors similar to sockets, you can get list of open semaphores with `% ipcs -s`.


----------



## jilles@ (Jun 10, 2011)

expl's answer is incorrect, ipcs(1) applies to System V IPC (also called XSI IPC) only, semget(2)/shmget(2)/msgget(2).

For sem_open(3), the answer depends on the version of FreeBSD (more precisely, the API you compile against, so running on 9.x a binary compiled on 8.x will give the 8.x behaviour).

In FreeBSD 9.x, sem_open creates a file named /tmp/SEMD followed by the name without the initial slash (which is mandatory, as documented by the man page).

In older versions, sem_open creates a special kernel object in its own namespace. There is no way to get a list of these objects.


----------

