Is it possible to access ocb in io_open?

I am writing a resource manager for A/D card. My idea is to create a device
(/dev/pcm3718),
which could be read by applications.

From user perspective:

fd_ad = open(…)

while(go){
count = read(fd_ad, … );
process count samples.
}

At subsequent reads I would give him just samples that driver acquired after
his last read.
Also I would like to give information to the client in case he missed
several samples.
I thought about returning -1 from read int this cas and setting ERANGE (or
is there sth. more suitable?).

THE PROBLEM:
From what I have written it means that in the first read user gets -1 and
ERANGE,
because the driver has acquired several samples, that client missed.

I would like to solve it by setting offset in ocb at “open” time. But I
can’t find a way to
access ocb structure in io_open. Is it possible?

int io_open (resmgr_context_t *ctp, io_open_t *msg, RESMGR_HANDLE_T *handle,
void *extra)
{
int ret;

ret = iofunc_open_default(ctp, msg, handle, extra);
if(ret == EOK) {
??? ocb->offset = my_w_index; ???
}

return(ret);
}


Thank you, Pavol Kycina

You could override the ocb calloc and set it then

IOFUNC_OCB_T *iofunc_ocb_calloc(resmgr_context_t *ctp, IOFUNC_ATTR_T *attr) {
struct file_ocb *ocb;

if(!(ocb = _scalloc(sizeof *ocb))) {
errno = ENFILE;
}

ocb->offset = -1;

return ocb;
}


Pavol Kycina <kycina@microstep-hdo.sk> wrote:

I am writing a resource manager for A/D card. My idea is to create a device
(/dev/pcm3718),
which could be read by applications.

From user perspective:

fd_ad = open(…)

while(go){
count = read(fd_ad, … );
process count samples.
}

At subsequent reads I would give him just samples that driver acquired after
his last read.
Also I would like to give information to the client in case he missed
several samples.
I thought about returning -1 from read int this cas and setting ERANGE (or
is there sth. more suitable?).

THE PROBLEM:
From what I have written it means that in the first read user gets -1 and
ERANGE,
because the driver has acquired several samples, that client missed.

I would like to solve it by setting offset in ocb at “open” time. But I
can’t find a way to
access ocb structure in io_open. Is it possible?

int io_open (resmgr_context_t *ctp, io_open_t *msg, RESMGR_HANDLE_T *handle,
void *extra)
{
int ret;

ret = iofunc_open_default(ctp, msg, handle, extra);
if(ret == EOK) {
??? ocb->offset = my_w_index; ???
}

return(ret);
}

Thank you, Pavol Kycina

_scalloc(sizeof *ocb)

should be

calloc(sizeof *ocb)

This is important to change because the default free() won’t match
the alloc.

Jason


Jason Clarke <jclarke@qnx.com> wrote:

You could override the ocb calloc and set it then

IOFUNC_OCB_T *iofunc_ocb_calloc(resmgr_context_t *ctp, IOFUNC_ATTR_T *attr) {
struct file_ocb *ocb;

if(!(ocb = _scalloc(sizeof *ocb))) {
errno = ENFILE;
}

ocb->offset = -1;

return ocb;
}



Pavol Kycina <> kycina@microstep-hdo.sk> > wrote:
I am writing a resource manager for A/D card. My idea is to create a device
(/dev/pcm3718),
which could be read by applications.

From user perspective:

fd_ad = open(…)

while(go){
count = read(fd_ad, … );
process count samples.
}

At subsequent reads I would give him just samples that driver acquired after
his last read.
Also I would like to give information to the client in case he missed
several samples.
I thought about returning -1 from read int this cas and setting ERANGE (or
is there sth. more suitable?).

THE PROBLEM:
From what I have written it means that in the first read user gets -1 and
ERANGE,
because the driver has acquired several samples, that client missed.

I would like to solve it by setting offset in ocb at “open” time. But I
can’t find a way to
access ocb structure in io_open. Is it possible?

int io_open (resmgr_context_t *ctp, io_open_t *msg, RESMGR_HANDLE_T *handle,
void *extra)
{
int ret;

ret = iofunc_open_default(ctp, msg, handle, extra);
if(ret == EOK) {
??? ocb->offset = my_w_index; ???
}

return(ret);
}

Thank you, Pavol Kycina

Thanks,

I did override the function as suggested, but it doesn’t work.
I put my offset into ocb->offset in ocb_calloc, then printf it, and it seems
to be ok.
But in my read handler, the value of offset is zero.

Just one question:
I did override function, but i din’t override it in mount structure, should
I?

Thanks, Pavol


“Jason Clarke” <jclarke@qnx.com> wrote in message
news:9ke8hs$mdr$1@nntp.qnx.com

You could override the ocb calloc and set it then

IOFUNC_OCB_T *iofunc_ocb_calloc(resmgr_context_t *ctp, IOFUNC_ATTR_T
*attr) {
struct file_ocb *ocb;

if(!(ocb = _scalloc(sizeof *ocb))) {
errno = ENFILE;
}

ocb->offset = -1;

return ocb;
}


Pavol Kycina <> kycina@microstep-hdo.sk> > wrote:
I am writing a resource manager for A/D card. My idea is to create a
device
(/dev/pcm3718),
which could be read by applications.

From user perspective:

fd_ad = open(…)

while(go){
count = read(fd_ad, … );
process count samples.
}

At subsequent reads I would give him just samples that driver acquired
after
his last read.
Also I would like to give information to the client in case he missed
several samples.
I thought about returning -1 from read int this cas and setting ERANGE
(or
is there sth. more suitable?).

THE PROBLEM:
From what I have written it means that in the first read user gets -1
and
ERANGE,
because the driver has acquired several samples, that client missed.

I would like to solve it by setting offset in ocb at “open” time. But I
can’t find a way to
access ocb structure in io_open. Is it possible?

int io_open (resmgr_context_t *ctp, io_open_t *msg, RESMGR_HANDLE_T
*handle,
void *extra)
{
int ret;

ret = iofunc_open_default(ctp, msg, handle, extra);
if(ret == EOK) {
??? ocb->offset = my_w_index; ???
}

return(ret);
}


Thank you, Pavol Kycina

Pavol Kycina a écrit :

I am writing a resource manager for A/D card. My idea is to create a device
(/dev/pcm3718),
which could be read by applications.

From user perspective:

fd_ad = open(…)

while(go){
count = read(fd_ad, … );
process count samples.
}

At subsequent reads I would give him just samples that driver acquired after
his last read.
Also I would like to give information to the client in case he missed
several samples.
I thought about returning -1 from read int this cas and setting ERANGE (or
is there sth. more suitable?).

THE PROBLEM:
From what I have written it means that in the first read user gets -1 and
ERANGE,
because the driver has acquired several samples, that client missed.

I would like to solve it by setting offset in ocb at “open” time. But I
can’t find a way to
access ocb structure in io_open. Is it possible?

int io_open (resmgr_context_t *ctp, io_open_t *msg, RESMGR_HANDLE_T *handle,
void *extra)
{
int ret;

ret = iofunc_open_default(ctp, msg, handle, extra);
if(ret == EOK) {
??? ocb->offset = my_w_index; ???
}

return(ret);
}

Thank you, Pavol Kycina

Yes I will be a little bit more precise than Jason.

First declare a ‘specific’ ocb structure; In fact it means that you will
overload the base structure. It’s also possible to overload the attribute
structure. It’s as you want, The ocb belongs to the client, it’s allocated by
open a freed by close, The attribute structure belongs to the device. As you
want!

typedef struct analog_ocb_s
{
iofunc_ocb_t ocb;
int offset;
}analog_ocb_t;
// Same as above to overload the attribute structure


The different resource manager functions use a generic IOFUNC_OCB_T as structure
type. You can change it to match your struct.

struct datas_server_ocb_s;
#define IOFUNC_OCB_T struct datas_server_ocb_s
// Same as above to redefine IOFUNC_ATTR_T

// Take care to include the following files in this order to prevent some
warnings!!
#include <sys/iofunc.h>
#include <sys/dispatch.h>
#include <sys/neutrino.h>


BUT, to be able to use your structure definition, you need to allocate it. This
is done by a allocation function called when you will perform an open. If you
decide to only overload the attribute structure, you don’t need this. The
io_open() will attach you structure the default ocb.

static iofunc_funcs_t analog_ocb_funcs = {
_IOFUNC_NFUNCS,
analog_ocb_calloc,
analog_ocb_free
};

static iofunc_mount_t analog_mount = {0, 0, 0, 0, &analog_ocb_funcs};


So, you will have to write these functions:

analog_ocb_t *
analog_ocb_calloc (resmgr_context_t *ctp, datas_server_attr_t *tattr)
{
analog_ocb_t *tocb;

if ((tocb = calloc (1, sizeof (analog_ocb_t))) == NULL) {
exit(errno);
}

tocb->offset = 0; // If it’s to set it with 0, it’s done by calloc() of
course!

return(tocb);
}

void
analog_ocb_free (analog_ocb_t *tocb)
{
free (tocb);
}


An io_open() is not necessary if you don’t have anything special to do in, but
the following is possible for sure;

int io_open (resmgr_context_t *ctp, io_open_t *msg, RESMGR_HANDLE_T *handle,
void *extra)
{
int ret;

ret = iofunc_open_default(ctp, msg, handle, extra);
if(ret == EOK) {
ocb->offset = my_w_index;
}

return(ret);
}

I didn’t check exactly when ocb_calloc() is called. Maybe in
io_func_open_default(), it may be explain in the doc but you can put some
printf() to see.

To declare you resource manager:

// If you supplied an attribute structure
iofunc_attr_init(&analog_attr.attr, S_IFNAM | 0666, 0, 0);
datas_server_attr.offset = 0;

// To add you own functions
iofunc_func_init(_RESMGR_CONNECT_NFUNCS, &analog_connect_funcs,
_RESMGR_IO_NFUNCS, &analog_io_funcs);
analog_connect_funcs.xxxx = …;
analog_io_funcs.xxxx = …;
// Don’t forget that!!!
analog_attr.attr.mount = &analog_mount;

if (resmgr_attach(dpp, &resmgr_attr, /dev/pcm3718, _FTYPE_ANY, 0,
&analog_connect_funcs, &analog_io_funcs, &analog_attr) == -1) {
exit(status);
}


And so on…

Hope it wiil help you!


regards,
Alain.

Thanks a lot for your thorough explanation.

At this time I don’t need to add anything into structures, so I will just
override ocb_calloc.

I would like to ask you about some details.

“Alain Bonnefoy” <alain.bonnefoy@icbt.com> wrote in message
news:3B6E460B.45416BAA@icbt.com

analog_ocb_t *
analog_ocb_calloc (resmgr_context_t *ctp, datas_server_attr_t *tattr)
{
analog_ocb_t *tocb;

if ((tocb = calloc (1, sizeof (analog_ocb_t))) == NULL) {
exit(errno);
}

tocb->offset = 0; // If it’s to set it with 0, it’s done by calloc()
of course!

??? I don’t want to set it with zero, but with other number. As I mentioned
in my previous post
if I set offset here to a non-zero number, in overriden read it’s zero
again… ???

return(tocb);
}


An io_open() is not necessary if you don’t have anything special to do in,
but
the following is possible for sure;

int io_open (resmgr_context_t *ctp, io_open_t *msg, RESMGR_HANDLE_T
*handle,
void *extra)
{
int ret;

ret = iofunc_open_default(ctp, msg, handle, extra);
if(ret == EOK) {
ocb->offset = my_w_index;
??? How can I access ocb. It’s not in parameter list, and it’s not global

variable ???

}

return(ret);
}

Thank you,

Pavol Kycina

Pavol Kycina a écrit :

Thanks a lot for your thorough explanation.

At this time I don’t need to add anything into structures, so I will just
override ocb_calloc.

I would like to ask you about some details.

Just a precision, maybe I didn’t really understand you in the message snippet
above.
ocb_calloc function is here to allocate the ocb structure you declared. It
means, by default a similar function is provided in the resource manager library
to allocate an ‘iofunc_ocb_t’ type structure. If you want to have an ‘offset’
field in this structure, you do have to declare a NEW structure, with an
‘iofunc_ocb_t’ field first and then as many other fields as you want. In your
case offset. The ocb_calloc function is here to replace the default function to
allocate YOUR ocb structure, as you can replace the default io_read, io_write,

you have to create the following structure

typedef struct analog_ocb_s
{
iofunc_ocb_t ocb;
int offset; // or whatever you want.
}analog_ocb_t;


Is it ok?

Alain.

“Alain Bonnefoy” <alain.bonnefoy@icbt.com> wrote in message
news:3B6E904B.123BAF5A@icbt.com

Pavol Kycina a écrit :

Thanks a lot for your thorough explanation.

At this time I don’t need to add anything into structures, so I will
just
override ocb_calloc.

I would like to ask you about some details.


Just a precision, maybe I didn’t really understand you in the message
snippet
above.
ocb_calloc function is here to allocate the ocb structure you declared. It
means, by default a similar function is provided in the resource manager
library
to allocate an ‘iofunc_ocb_t’ type structure. If you want to have an
‘offset’
field in this structure, you do have to declare a NEW structure,

Interesting point Alain. In fact I beleive that changing the offset at
the open
is not POSIX. After the open offset must either point to the beginning or
the
end of the file.

You are using offset for something else then what it was intended. It seems
you are using the offset to point to YOUR data. But it’s intended to point
the FILE data. In fact it seems your device “/dev/pcm3718” shouldn’t
be treated as a file, but rather as a character device. I mean you can’t
seek() this, just like you can’t seek() in a serial port.


‘iofunc_ocb_t’ field first and then as many other fields as you want. In
your
case offset. The ocb_calloc function is here to replace the default
function to
allocate YOUR ocb structure, as you can replace the default io_read,
io_write,

you have to create the following structure

typedef struct analog_ocb_s
{
iofunc_ocb_t ocb;
int offset; // or whatever you want.
}analog_ocb_t;


Is it ok?

Alain.

“Mario Charest” <mcharest@zinformatic.com> wrote in message
news:9km887$e76$1@inn.qnx.com
[snip]

Interesting point Alain. In fact I beleive that changing the offset at
the open
is not POSIX. After the open offset must either point to the beginning or
the
end of the file.

You are using offset for something else then what it was intended. It
seems
you are using the offset to point to YOUR data. But it’s intended to
point
the FILE data. In fact it seems your device “/dev/pcm3718” shouldn’t
be treated as a file, but rather as a character device. I mean you can’t
seek() this, just like you can’t seek() in a serial port.

You are right, I would like to use it in a way I use serial devices.
(just read samples from device, if there are several clients,
each can read all samples … that’s different from serial devices)

I have overriden the seek (it returns ENOSYS immediately.)

Is it safe to use offset from ocb or should I add sth like my_offset
to my_ocb and then I can use it in a way I want?

Thank you,

Pavol Kycina

“Pavol Kycina” <kycina@microstep-hdo.sk> wrote in message
news:3b6f98a1$1@asrpx.mshdo

“Mario Charest” <> mcharest@zinformatic.com> > wrote in message
news:9km887$e76$> 1@inn.qnx.com> …
[snip]

Interesting point Alain. In fact I beleive that changing the offset
at
the open
is not POSIX. After the open offset must either point to the beginning
or
the
end of the file.

You are using offset for something else then what it was intended. It
seems
you are using the offset to point to YOUR data. But it’s intended to
point
the FILE data. In fact it seems your device “/dev/pcm3718” shouldn’t
be treated as a file, but rather as a character device. I mean you
can’t
seek() this, just like you can’t seek() in a serial port.

You are right, I would like to use it in a way I use serial devices.
(just read samples from device, if there are several clients,
each can read all samples … that’s different from serial devices)

I have overriden the seek (it returns ENOSYS immediately.)

Is it safe to use offset from ocb

It is in general but apparently not in this perticular case.
I’ve given a quick look at the resource manager source
and in fact after the ocb is allocated the offset is reset to 0.

to my_ocb and then I can use it in a way I want?

You could probably find a way to access the ocb in the open
but looking at the source this looks ugly :wink:

You could also extend the ocb to have a “first_use” flag and
keep using ocb->offset, the read handler would check if first_use is
set and would not return an error in this perticular case.
That would have the advantage of supporting seek if you ever come to
need it for some reason.

That’s what I would do. Also consider using S_IFCHR flag
to set your device as a character device.

Thank you,

Pavol Kycina

Mario Charest a écrit :

“Pavol Kycina” <> kycina@microstep-hdo.sk> > wrote in message
news:3b6f98a1$> 1@asrpx.mshdo> …
“Mario Charest” <> mcharest@zinformatic.com> > wrote in message
news:9km887$e76$> 1@inn.qnx.com> …
[snip]

Interesting point Alain. In fact I beleive that changing the offset
at
the open
is not POSIX. After the open offset must either point to the beginning
or
the
end of the file.

You are using offset for something else then what it was intended. It
seems
you are using the offset to point to YOUR data. But it’s intended to
point
the FILE data. In fact it seems your device “/dev/pcm3718” shouldn’t
be treated as a file, but rather as a character device. I mean you
can’t
seek() this, just like you can’t seek() in a serial port.

You are right, I would like to use it in a way I use serial devices.
(just read samples from device, if there are several clients,
each can read all samples … that’s different from serial devices)

I have overriden the seek (it returns ENOSYS immediately.)

Is it safe to use offset from ocb

It is in general but apparently not in this perticular case.
I’ve given a quick look at the resource manager source
and in fact after the ocb is allocated the offset is reset to 0.

to my_ocb and then I can use it in a way I want?


You could probably find a way to access the ocb in the open
but looking at the source this looks ugly > :wink:

You could also extend the ocb to have a “first_use” flag and
keep using ocb->offset, the read handler would check if first_use is
set and would not return an error in this perticular case.
That would have the advantage of supporting seek if you ever come to
need it for some reason.

That’s what I would do. Also consider using S_IFCHR flag
to set your device as a character device.

Thank you,

Pavol Kycina
\

Maybe I didn’t understand what Pavol really wanted to do because I was not
talking about the offset variable located in ocb structure. I though that Pavol
was talking about a new offset field stored outside the standard ocb. It’s
because I was talking about overloading the standard ocb!

Sorry for my misunderstanding!!!

In fact, to use the ocb->offset it’s really simple. Just after open()
ocb->offset is initialized at 0 because the ocb has just been allocated by a
calloc() call. In your io_read you can update the offset as you want. Normally,
it’s updated by ocb->offset += nbytes meanning that we have replied to the
client reading request by sending back ‘nbytes’. So, we have also

MsgReply(ctp->rcvid, 0, reply_buffer, nbytes);

While nbytes is different of 0, the resource manager library will perform
others IO_READ messages. When you have sent all your datas back to the client
just do:

MsgReply(ctp->rcvid, 0, NULL, 0);

and now, ocb->offset will be equal to the number of bytes replied, of course.


Alain.

“Alain Bonnefoy” <alain.bonnefoy@icbt.com> wrote in message
news:3B6FFF0E.77EE4C5@icbt.com

Mario Charest a écrit :

“Pavol Kycina” <> kycina@microstep-hdo.sk> > wrote in message
news:3b6f98a1$> 1@asrpx.mshdo> …
“Mario Charest” <> mcharest@zinformatic.com> > wrote in message
news:9km887$e76$> 1@inn.qnx.com> …
[snip]

Interesting point Alain. In fact I beleive that changing the
offset
at
the open
is not POSIX. After the open offset must either point to the
beginning
or
the
end of the file.

You are using offset for something else then what it was intended.
It
seems
you are using the offset to point to YOUR data. But it’s intended
to
point
the FILE data. In fact it seems your device “/dev/pcm3718”
shouldn’t
be treated as a file, but rather as a character device. I mean you
can’t
seek() this, just like you can’t seek() in a serial port.

You are right, I would like to use it in a way I use serial devices.
(just read samples from device, if there are several clients,
each can read all samples … that’s different from serial devices)

I have overriden the seek (it returns ENOSYS immediately.)

Is it safe to use offset from ocb

It is in general but apparently not in this perticular case.
I’ve given a quick look at the resource manager source
and in fact after the ocb is allocated the offset is reset to 0.

to my_ocb and then I can use it in a way I want?


You could probably find a way to access the ocb in the open
but looking at the source this looks ugly > :wink:

You could also extend the ocb to have a “first_use” flag and
keep using ocb->offset, the read handler would check if first_use is
set and would not return an error in this perticular case.
That would have the advantage of supporting seek if you ever come to
need it for some reason.

That’s what I would do. Also consider using S_IFCHR flag
to set your device as a character device.

Thank you,

Pavol Kycina




Maybe I didn’t understand what Pavol really wanted to do because I was not
talking about the offset variable located in ocb structure. I though that
Pavol
was talking about a new offset field stored outside the standard ocb. It’s
because I was talking about overloading the standard ocb!

Sorry for my misunderstanding!!!

In fact, to use the ocb->offset it’s really simple. Just after open()
ocb->offset is initialized at 0 because the ocb has just been allocated by
a
calloc() call.

No ocb->offset is explicitely set to 0 by the resource manager library.

Pavol problem is he would need ocb->offset to be set to something else then
0
before the io_read.

I though that in your post you where suggesting to extend ocb to have
a “private” offset variable, which looks like a good idea :wink:

“Mario Charest” <mcharest@zinformatic.com> wrote in message
news:9kp17g$69q$1@inn.qnx.com

“Alain Bonnefoy” <> alain.bonnefoy@icbt.com> > wrote in message

[snip]

Maybe I didn’t understand what Pavol really wanted to do because I was
not
talking about the offset variable located in ocb structure. I though
that
Pavol
was talking about a new offset field stored outside the standard ocb.
It’s
because I was talking about overloading the standard ocb!

Sorry for my misunderstanding!!!

In fact, to use the ocb->offset it’s really simple. Just after open()
ocb->offset is initialized at 0 because the ocb has just been allocated
by
a
calloc() call.

No ocb->offset is explicitely set to 0 by the resource manager library.

Pavol problem is he would need ocb->offset to be set to something else
then
0
before the io_read.

I though that in your post you where suggesting to extend ocb to have
a “private” offset variable, which looks like a good idea > :wink:

I will go this way, I will add my_offset to ocb. It will cost me several
source
code lines more, but I will probably get the behaviour I want.

Thank you all for your comments.

Pavol Kycina

PS: But my original question is still here: Is it possible to access ocb in
io_open?
(after it has been allocated and resmgr_ocb_bound?)
PS2: Mario, where did you find source code of resmgr library?

Pavol Kycina a écrit :

“Mario Charest” <> mcharest@zinformatic.com> > wrote in message
news:9kp17g$69q$> 1@inn.qnx.com> …
“Alain Bonnefoy” <> alain.bonnefoy@icbt.com> > wrote in message

[snip]

Maybe I didn’t understand what Pavol really wanted to do because I was
not
talking about the offset variable located in ocb structure. I though
that
Pavol
was talking about a new offset field stored outside the standard ocb.
It’s
because I was talking about overloading the standard ocb!

Sorry for my misunderstanding!!!

In fact, to use the ocb->offset it’s really simple. Just after open()
ocb->offset is initialized at 0 because the ocb has just been allocated
by
a
calloc() call.

No ocb->offset is explicitely set to 0 by the resource manager library.

Pavol problem is he would need ocb->offset to be set to something else
then
0
before the io_read.

I though that in your post you where suggesting to extend ocb to have
a “private” offset variable, which looks like a good idea > :wink:


I will go this way, I will add my_offset to ocb. It will cost me several
source
code lines more, but I will probably get the behaviour I want.

Thank you all for your comments.

Pavol Kycina

PS: But my original question is still here: Is it possible to access ocb in
io_open?
(after it has been allocated and resmgr_ocb_bound?)
PS2: Mario, where did you find source code of resmgr library?

Yes of course! but only after the call to iofunc_open_default because the ocb
is allocated in this function.

for the resmgr sources files look at
http://cvs.qnx.com/cgi-bin/cvsweb.cgi/nto/libc/resmgr/

access to it with the cvs utility, it’s explained on the web page.

regards,
Alain.

“Alain Bonnefoy” <alain.bonnefoy@icbt.com> wrote in message
news:3B70E1CE.3B946AAD@icbt.com

[snip]

PS: But my original question is still here: Is it possible to access ocb
in
io_open?
(after it has been allocated and resmgr_ocb_bound?)
PS2: Mario, where did you find source code of resmgr library?

Yes of course! but only after the call to iofunc_open_default because the
ocb
is allocated in this function.

But how??? What structure is it part of?

for the resmgr sources files look at
http://cvs.qnx.com/cgi-bin/cvsweb.cgi/nto/libc/resmgr/

I tried, but I can’t connect to it through proxy server. (Is it possible?)
Web intreface doesn’t permit searching. :frowning:

Pavol Kycina

Pavol Kycina a écrit :

“Alain Bonnefoy” <> alain.bonnefoy@icbt.com> > wrote in message
news:> 3B70E1CE.3B946AAD@icbt.com> …

[snip]


PS: But my original question is still here: Is it possible to access ocb
in
io_open?
(after it has been allocated and resmgr_ocb_bound?)
PS2: Mario, where did you find source code of resmgr library?

Yes of course! but only after the call to iofunc_open_default because the
ocb
is allocated in this function.

But how??? What structure is it part of?

Ok, if you want to access to the default ocb, I don’t know! I will try to find.
Maybe Mario knows.
What I can say is that io_func_open_default() call iofunc_ocb_attach (ctp, msg,
0, attr, 0), which call, after calloc() for the ocb structure,
resmgr_open_bind(ctp, ocb, io_funcs) which call resmgr_handle(…)… So, it
would be somewhere in the ctp!

Do you really want to access to the ocb in io_open() ?

Now, if you want to add a private field to the ocb, it’s really easier to do!
Look at one of my previous message!

for the resmgr sources files look at
http://cvs.qnx.com/cgi-bin/cvsweb.cgi/nto/libc/resmgr/


I tried, but I can’t connect to it through proxy server. (Is it possible?)
Web intreface doesn’t permit searching. > :frowning:

Pavol Kycina

You may be in 6.1. I didn’t check this access with cvs but the package installer
seems to have some problems with the proxy server.

You really need the resmgr library to answer the question.
No, there is no “offical way” to do what you want. Unoffically,
you can call:

ocb = _resmgr_ocb(ctp, &ctp->info);

after binding it.

-xtang

Alain Bonnefoy <alain.bonnefoy@icbt.com> wrote:

Pavol Kycina a écrit :

“Alain Bonnefoy” <> alain.bonnefoy@icbt.com> > wrote in message
news:> 3B70E1CE.3B946AAD@icbt.com> …

[snip]


PS: But my original question is still here: Is it possible to access ocb
in
io_open?
(after it has been allocated and resmgr_ocb_bound?)
PS2: Mario, where did you find source code of resmgr library?

Yes of course! but only after the call to iofunc_open_default because the
ocb
is allocated in this function.

But how??? What structure is it part of?

Ok, if you want to access to the default ocb, I don’t know! I will try to find.
Maybe Mario knows.
What I can say is that io_func_open_default() call iofunc_ocb_attach (ctp, msg,
0, attr, 0), which call, after calloc() for the ocb structure,
resmgr_open_bind(ctp, ocb, io_funcs) which call resmgr_handle(…)… So, it
would be somewhere in the ctp!

Do you really want to access to the ocb in io_open() ?

Now, if you want to add a private field to the ocb, it’s really easier to do!
Look at one of my previous message!




for the resmgr sources files look at
http://cvs.qnx.com/cgi-bin/cvsweb.cgi/nto/libc/resmgr/


I tried, but I can’t connect to it through proxy server. (Is it possible?)
Web intreface doesn’t permit searching. > :frowning:

Pavol Kycina

You may be in 6.1. I didn’t check this access with cvs but the package installer
seems to have some problems with the proxy server.

“Xiaodan Tang” <xtang@qnx.com> wrote in message
news:9krj9m$15n$1@nntp.qnx.com

You really need the resmgr library to answer the question.
No, there is no “offical way” to do what you want. Unoffically,
you can call:

ocb = _resmgr_ocb(ctp, &ctp->info);

after binding it.

-xtang

[snip]

Thank you very much.

_resmgr_ocb is exactly what I was looking for.
It’s a pity it’s unofficial, I think it could be handy even if you are
allocating your own ocb structure.

One more question:
Imagine, you want to check all the “clients” of resource manager from time
to time
(if their are active or inactive, …)
Is there any way to walk through them ? Or should I create my own list?
(by Overriding ocb_alloc and ocb_dealloc)

Thanks again,

Pavol Kycina