| Author |
Message |
|
|
Post subject: resmgr_attach() and path that already exist
Posted: Mar 27, 2008 - 10:44 AM
|
|
Senior Member
Joined: May 16, 2006
Posts: 136
|
|
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
} |
|
|
| |
|
|
|
 |
|
|
Post subject: Re: resmgr_attach() and path that already exist
Posted: Mar 27, 2008 - 04:08 PM
|
|
QNX Master
Joined: Jul 11, 2002
Posts: 600
|
|
|
oink wrote:
why I can attach path (e.g. "/dev/logdev") to pathname space
more than once without any error?
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  |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Re: resmgr_attach() and path that already exist
Posted: Mar 27, 2008 - 06:28 PM
|
|
QNX Master
Joined: Jun 25, 2003
Posts: 1041
|
|
| 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. |
|
|
| |
|
|
|
 |
|
|
Powered by PNphpBB2 © 2003-2007 The PNphpBB Group Credits |
|
|