testing open mode of resource manager in 6.1

Hello,

In Krten’s book (Getting Started with Neutrino 2.0, first printing, p. 285),
he
suggests using (ioflag & _READ) or (ioflag & _WRITE) to check the open
mode of a resource manager. In QNX 6.0, _READ and _WRITE are defined in
stdio.h. In QNX 6.1, they are nowhere to be found.

  1. What is the “proper” way to check the open mode of a resource manager in
    6.1?

  2. Where is this documented?

Thanks,

-Arthur

See Where is _WRITE from 1/11/01 for discussion on this one

Poseidon

Operating System Tech Support <os@qnx.com> wrote:

“Arthur” <> 3_arthur@my-deja.com> > wrote in message
news:9s1ddn$8ev$> 1@inn.qnx.com> …
Hello,

In Krten’s book (Getting Started with Neutrino 2.0, first printing, p.
285),
he
suggests using (ioflag & _READ) or (ioflag & _WRITE) to check the open
mode of a resource manager. In QNX 6.0, _READ and _WRITE are defined in
stdio.h. In QNX 6.1, they are nowhere to be found.

  1. What is the “proper” way to check the open mode of a resource manager
    in
    6.1?
  2. Where is this documented?

Check out iofunc_read_verify() in the documents. If you really want to use
_READ _WRITE you can always define them:

#define _READ 0x0001
#define _WRITE 0x0002

Actually really what you want to do is use _IO_FLAG_RD and
_IO_FLAG_WR from <sys/iomsg.h>. If you look at the connect
message:

struct _io_connect {
[snip]
Uint32t ioflag; /* O? in fcntl.h & IO_FLAG? */
[snip]
};

And then search for IO_FLAG* you get:

/* struct io_connect ioflag (non-masked values match O? in fcntl.h) /
#define _IO_FLAG_RD 0x00000001 /
read permission /
#define _IO_FLAG_WR 0x00000002 /
write permission /
#define _IO_FLAG_MASK 0x00000003 /
permission mask */

And this is the way it should be done.

Thomas … not replying to all of the other cross posts.

Thomas (toe-mah) Fletcher QNX Software Systems
thomasf@qnx.com Core OS Technology Group
(613)-591-0931 http://www.qnx.com/

“Operating System Tech Support” <os@qnx.com> wrote in message
news:9s6ooa$9v0$1@nntp.qnx.com

thomasf@qnx.com> > wrote in message news:9s6l24$7g4$> 1@nntp.qnx.com> …

Actually really what you want to do is use _IO_FLAG_RD and
_IO_FLAG_WR from <sys/iomsg.h>. If you look at the connect
message:

Yes, definately a better idea.

Perhaps if you wish to compile on both the 6.0 and 6.1A you could make you
own macro set (MY_READ, MY_WRITE) to define the proper macro for
compilation.

-Adam

Actually, _IO_FLAG_RD and _IO_FLAG_WR are defined in <sys/iomsg.h

in 6.0 as well, so it makes sense to use them directly. Thanks everyone!

-Arthur

“Arthur” <3_arthur@my-deja.com> wrote in message
news:9s1ddn$8ev$1@inn.qnx.com

Hello,

In Krten’s book (Getting Started with Neutrino 2.0, first printing, p.
285),
he
suggests using (ioflag & _READ) or (ioflag & _WRITE) to check the open
mode of a resource manager. In QNX 6.0, _READ and _WRITE are defined in
stdio.h. In QNX 6.1, they are nowhere to be found.

  1. What is the “proper” way to check the open mode of a resource manager
    in
    6.1?
  2. Where is this documented?

Check out iofunc_read_verify() in the documents. If you really want to use
_READ _WRITE you can always define them:

#define _READ 0x0001
#define _WRITE 0x0002

-Adam

<thomasf@qnx.com> wrote in message news:9s6l24$7g4$1@nntp.qnx.com

Actually really what you want to do is use _IO_FLAG_RD and
_IO_FLAG_WR from <sys/iomsg.h>. If you look at the connect
message:

Yes, definately a better idea.

Perhaps if you wish to compile on both the 6.0 and 6.1A you could make you
own macro set (MY_READ, MY_WRITE) to define the proper macro for
compilation.

-Adam