Skip navigation.
Home
The QNX Community Portal

View topic - Resource manager and directories: get path for io_read/write

Resource manager and directories: get path for io_read/write

Discussion about the QNX6 OS.

Resource manager and directories: get path for io_read/write

Postby pault » Mon Dec 16, 2013 10:45 am

Hello,

I'm trying to use the resource manager for a debug interface.
Different applications will be enabled to open a device such as : "/dev/remote/app1" or "/dev/remote/app2" etc...

So I created a resource manager with the directory flag : resmgr_attach with falg = _RESMGR_FLAG_DIR
Code: Select all
 id = resmgr_attach(   dpp,               // dispatch handle
               &(resmgr_attr),      // resource manager attrs
               "/dev/remote",              // device name
               _FTYPE_ANY,                    // open type
               _RESMGR_FLAG_DIR,                    // flags
               &connect_funcs,    // connect routines
               &io_funcs,         // I/O routines
               &attr);            // handle


When a client does for example :
Code: Select all
open("/dev/remote/app1",O_RDWR);     


it works and triggers the io_open func, here I can retrieve the path (app1) in the io_open_t *msg (msg->connect.path)
Code: Select all
int io_open_remote (resmgr_context_t *ctp, io_open_t *msg, RESMGR_HANDLE_T *handle, void *extra)
{
   printf("io_open_remote: path [%s]\n"
         ,msg->connect.path);
}

Then on a read or write .... how do I get this path back ? Through the ocb structure ?

Or am I supposed to do another resmgr_attach when the io_open happens ?

Sorry if my questions are silly...but I'm kind of lost here...

Thanks for any answer,

Paul
pault
New Member
 
Posts: 6
Joined: Wed Dec 08, 2010 9:33 am

Re: Resource manager and directories: get path for io_read/w

Postby maschoen » Mon Dec 16, 2013 6:36 pm

If there isn't a way to get to the path from read, the work around is as follows. You create and use an enhanced ocb instead of the ocb. An eocb is just an ocb with more data at the end that you can define yourself. Then you stick the path in beyond where the ocb ends. To do this, you have to modify the ocb allocate routine, and change your references to struct ocb to your new struct eocb.
maschoen
QNX Master
 
Posts: 2644
Joined: Wed Jun 25, 2003 5:18 pm


Return to QNX6 - OS

Who is online

Users browsing this forum: No registered users and 3 guests