Skip navigation.
The QNX Community Portal

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

Page 1 of 1

Resource manager and directories: get path for io_read/write

PostPosted: Mon Dec 16, 2013 10:45 am
by pault

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

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"

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,


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

PostPosted: Mon Dec 16, 2013 6:36 pm
by maschoen
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.