shm_unlink - file descriptor

hi,

is der any possibility to find the number of open connections to a shared memory object?

i want carry out “shm_unlink()” if the link count is 1 otherwise “close()”.

thx

stat()

hm, stat()…

which member in stat contains the number of open connections?

if i should guess


nlink_t st_nlink; /* Number of hard links to the file. */

it seems to be:

nlink_t st_nlink; /* Number of hard links to the file. */

note:
nlink_t st_nlink; /* Number of hard links to the file. */
is not 1 if only one connection is open, it is 3, i dont know why ;(

Maybe: 1 (Link for file on disc/ram), 2 (shm_open()), 3 (another app or may stat()) – Something like this ^^

one more question ;)

if i do n x mq_open() [n>1]

the stat(<mq_filname>,buf) buf.st_nlink is always 1 ??

i need to know how many connections currently open to a message queue.

i use the oldstyle mqueue