Distinguishing between open() and opendir() in a resmgr

Is there a way of telling within my resmgr io_open callout if
I’m being called as a result of the client doing an open()
versus an opendir()?

I’ve thought of a few ways:
a) check the eflag against _DIR, and assume that if set it was
an opendir()
b) stat() the target, and if it’s got S_ISDIR set, assume it
was an opendir() (And if I can’t stat() the file, assume it
as an open())

Is there an “official” way of checking?

Thanks in advance!

Cheers,
-RK


Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at www.parse.com.
Email my initials at parse dot com.

John Garvey <jgarvey@qnx.com> wrote:

Robert Krten <> nospam84@parse.com> > wrote:
Is there a way of telling within my resmgr io_open callout if
I’m being called as a result of the client doing an open()
versus an opendir()?

No. opendir() is just some DIR housekeeping and a call to
open(O_RDONLY) of the directory (some minor details skipped > :slight_smile:
which could easily occur elsewhere. Unlike QNX4 which was a
unique IO_HANDLE subtype, I think you’re into “assume” for QNX6.

Ok, thanks John. I’ll assume :slight_smile:

Cheers,
-RK


Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at www.parse.com.
Email my initials at parse dot com.

Robert Krten <nospam84@parse.com> wrote:

Is there a way of telling within my resmgr io_open callout if
I’m being called as a result of the client doing an open()
versus an opendir()?

No. opendir() is just some DIR housekeeping and a call to
open(O_RDONLY) of the directory (some minor details skipped :slight_smile:
which could easily occur elsewhere. Unlike QNX4 which was a
unique IO_HANDLE subtype, I think you’re into “assume” for QNX6.

nospam84@parse.com (Robert Krten) wrote in news:b0h5bq$b3l$1@inn.qnx.com:

Is there a way of telling within my resmgr io_open callout if
I’m being called as a result of the client doing an open()
versus an opendir()?

Is there an “official” way of checking?

It would be really nice to know this. I had to assume and it also
eliminates the possibility of being both a file AND a directory (e.g. .zip
file is both).

Dwayne

Dwayne Nelson <dwayne.nelson@igt.com> wrote:

nospam84@parse.com > (Robert Krten) wrote in news:b0h5bq$b3l$> 1@inn.qnx.com> :

Is there a way of telling within my resmgr io_open callout if
I’m being called as a result of the client doing an open()
versus an opendir()?

Is there an “official” way of checking?

It would be really nice to know this. I had to assume and it also
eliminates the possibility of being both a file AND a directory (e.g. .zip
file is both).

My understanding from teaching this is that the only way you can tell
is by what is being openened.

That is opendir(), readdir() on the client side come in as
IO_OPEN and IO_READ messages indistinguishable from a
open() and read() on the client side.

(e.g. try “cat /bin | less”)

This, unfortunately, does not let you use the same name as both a
file or directory, and thereby return different data depending on
what type of “open” you got. (Though it would be kind of neat if
you could.)

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.