Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/m/msgwritev.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/m/msgwritev.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/m/msgwritev.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/m/msgwritev.html on line 8

MsgWritev(), MsgWritev_r()

Write a reply

Synopsis:

#include <sys/neutrino.h>

int MsgWritev( int rcvid,
               const iov_t* iov,
               int parts,
               int offset );

int MsgWritev_r( int rcvid,
                 const iov_t* iov,
                 int parts,
                 int offset );

Arguments:

rcvid
The value returned by MsgReceive*() when you received the message.
iov
An array of buffers that contains the data you want to write.
parts
The number of elements in the array. These functions don't let you write past the end of the sender's buffer; they return the number of bytes actually written.
offset
An offset into the sender's buffer that indicates where you want to start writing the data.

Library:

libc

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

Description:

The MsgWritev() and MsgWritev_r() kernel calls write data to the reply buffer of a thread identified by rcvid. The thread being written to must be in the REPLY-blocked state. Any thread in the receiving process is free to write to the reply message.

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

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

You'll use this function in one of these situations:

To complete a message exchange, you must call MsgReply*(). The reply doesn't need to contain any data. If it does contain data, then the data is always written at offset zero in the destination thread's reply message buffer. This is a convenient way of writing the header once all of the information has been gathered.

A single call to MsgReply*() is always more efficient than calls to MsgWritev() followed by a call to MsgReply*().

Blocking states

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

Returns:

The only difference between the MsgWritev() and MsgWritev_r() functions is the way they indicate errors:

MsgWritev()
The number of bytes written. If an error occurs, -1 is returned and errno is set.
MsgWritev_r()
The number of bytes written. 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 the sender's address space when a server tried to access the sender's return message buffer.
ESRCH
The thread indicated by rcvid doesn't exist or its connection was 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(), MsgReadv(), MsgReceive(), MsgReceivev(), MsgReply(), MsgReplyv(), MsgWrite()

Message Passing chapter of Getting Started with QNX Neutrino


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/m/msgwritev.html on line 232

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/m/msgwritev.html on line 232