resmgr_attach() and path that already exist

why I can attach path (e.g. “/dev/logdev”) to pathname space
more than once without any error?

is there any way to force resmgr_attach()
to return error when I call it with the same path
more than once?

some code:

attach name fragment code:
link_id = resmgr_attach(
resmgr_dpp,
&resmgr_attr,
“/dev/logdev”,
_FTYPE_ANY,
0,
&resmgr_connect_funcs,
&resmgr_io_funcs,
&dev_attr);

checking if name “/dev/logdev” exist:
if (access("/dev/logdev", F_OK) == 0)
{
// “/dev/logdev” already exist - terminate programm
}

Because union/stacked namespaces are a really cool feature of QNX!

Attaching multiple instances of a namespace is not an error, it is a really slick feature.

This is used (for example) to support software redundancy, by having a backup resource manager attach the same prefix. If the first one crashes (for whatever reason) clients seamlessly begin using the new server (no special client code required).

Another use is union filesystems. This is the ability to mount (say) /media/mp3 multiple times from (say) a USB memory stick, CD, and harddisk, and to see a union of all the mp3’s available on all 3 devices, in a single directory.

So rather than asking for a way to make QNX behave like less capable operating systems (by asking it to return an error) perhaps you should experiment with the really cool things you can do with this capability :slight_smile:

You might get the behavior you want by having your manager first checking whether /dev/logdev already exists. This is a little chancy in that it could fail because of a race condition. If this is a problem, find some other resource to sync on.