user6108870
user6108870

Reputation:

Where is POSIX named Semaphore stored?

A named semaphore(using semaphore.h) is identified by a name of the form /somename; that is, a null-terminated string of up to NAME_MAX-4 (i.e., 251) characters consisting of an initial slash, followed by one or more characters, none of which are slashes.

As the name corresponds to pathname in filesystem. Where this semaphore is located?

ipcs -s not showing named semaphore as ipcs is for System V semaphores.How to locate POSIX semaphores?

Upvotes: 4

Views: 3131

Answers (1)

Toby Speight
Toby Speight

Reputation: 30790

From the sem_overview man page:

On Linux, named semaphores are created in a virtual filesystem, normally mounted under /dev/shm, with names of the form sem.somename. (This is the reason that semaphore names are limited to NAME_MAX-4 rather than NAME_MAX characters.)

Do not expect this detail to be remotely similar on non-Linux systems (in fact, don't even expect semaphores to be visible by any means other than sem_open()).

Upvotes: 6

Related Questions