List named semaphores

Anurag Uniyal picture Anurag Uniyal · Aug 10, 2011 · Viewed 12.3k times · Source

Is there a way to list all posix-named-semaphores, ipcs doesn't seem to give any info about posix semaphores e.g. ipcs -s output is

------ Semaphore Arrays --------
key        semid      owner      perms      nsems     
0xcbc384f8 32769      xxx    600        1

Though I have created many posix semaphores and listing `/dev/shm' shows them

-rw------- 1 xxx auniyal 16 2011-08-09 15:59 /dev/shm/sem.mysem
-rw------- 1 auniyal auniyal 16 2011-08-09 16:29 /dev/shm/sem.mysem1

Answer

Anurag Uniyal picture Anurag Uniyal · Aug 10, 2011

So for now solution seems to be to list /dev/shm e.g.

$ ls -al /dev/shm/sem.*|more
-rw------- 1 auniyal auniyal 16 2011-08-09 15:59 /dev/shm/sem.mysem
-rw------- 1 auniyal auniyal 16 2011-08-09 16:29 /dev/shm/sem.mysem1
-rw------- 1 auniyal auniyal 16 2011-08-09 16:37 /dev/shm/sem.mysem2
-rw------- 1 auniyal auniyal 16 2011-08-09 16:37 /dev/shm/sem.mysem3
-rw------- 1 auniyal auniyal 16 2011-08-09 16:39 /dev/shm/sem.mysem4
...