OpenQNX :: The QNX Community Portal

Jul 19, 2008 - 03:32 PM
Google
  Web openqnx.com   
     Create an account Home · Submit News · QNX Forums · QNX Download · Search   
_
Main Menu
Who's Online
There are 37 unlogged users and 0 registered users online.

You can log-in or register for a user account here.

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
oink
Post subject: resmgr_attach() and path that already exist  PostPosted: 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
}
 
 View user's profile Send private message  
Reply with quote Back to top
rgallen
Post subject: Re: resmgr_attach() and path that already exist  PostPosted: 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 Smile
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
maschoen
Post subject: RE: Re: resmgr_attach() and path that already exist  PostPosted: 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.
 
 View user's profile Send private message Send e-mail Visit poster's website  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2007 The PNphpBB Group
Credits
All logos and trademarks in this site are property of their respective owners. The comments are property of their posters.
Powered by OpenQNX: The QNX Community Portal Site
QNX and the QNX logo are registered trademarks of QNX Software Systems.