[Previous] [Contents] [Index] [Next]

Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

MsgReadv(), MsgReadv_r()

Read data from a message

Synopsis:

#include <sys/neutrino.h>

int MsgReadv( int rcvid,
              const iov_t* riov,
              int rparts,
              int offset );

int MsgReadv_r( int rcvid,
                const iov_t* riov,
                int rparts,
                int offset );

Arguments:

rcvid
The value returned by MsgReceive*() when you received the message.
riov
An array of buffers where the functions can store the data.
rparts
The number of elements in the riov array.
offset
An offset into the thread's send message that indicates where you want to start reading the data.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The MsgReadv() and MsgReadv_r() kernel calls read data from a message sent by a thread identified by rcvid. The thread being read from must not have been replied to and will be in the REPLY-blocked state. Any thread in the receiving process is free to read the message.

These functions are identical except in the way they indicate errors. See the Returns section for details.

The data transfer occurs immediately and the thread doesn't block. The state of the sending thread doesn't change.

An attempt to read past the end of the thread's message results in fewer bytes returned than requested.

You'll use these functions in these situations:

When you're finished using MsgReadv(), you must use MsgReply*() to ready the REPLY-blocked process and complete the message exchange.

Blocking states

None. In the network case, lower priority threads may run.

Returns:

The only difference between the MsgReadv() and MsgReadv_r() functions is the way they indicate errors:

MsgReadv()
The number of bytes read. If an error occurs, -1 is returned and errno is set.
MsgReadv_r()
The number of bytes read. This function does NOT set errno. If an error occurs, the negative of a value from the Errors section is returned.

Errors:

EFAULT
A fault occurred in a server's address space when it tried to access the caller's message buffers.
ESRCH
The thread indicated by rcvid doesn't exist or has had its connection detached.
ESRVRFAULT
A fault occurred when the kernel tried to access the buffers provided.

Classification:

QNX Neutrino

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

MsgRead(), MsgReceive(), MsgReceivev(), MsgReply(), MsgReplyv(), MsgWrite(), MsgWritev()


[Previous] [Contents] [Index] [Next]