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/msgreply.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/msgreply.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/msgreply.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/msgreply.html on line 8

MsgReply(), MsgReply_r()

Reply with a message

Synopsis:

#include <sys/neutrino.h>

int MsgReply( int rcvid,
              int status,
              const void* msg,
              int size );

int MsgReply_r( int rcvid,
                int status,
                const void* msg,
                int size );

Arguments:

rcvid
The receive ID that MsgReceive*() returned when you received the message.
status
The status to use when unblocking the MsgSend*() call in the rcvid thread.
msg
A pointer to a buffer that contains the message that you want to reply with.
size
The size of the message, in bytes.

Library:

libc

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

Description:

The MsgReply() and MsgReply_r() kernel calls reply with a message to the thread identified by rcvid. The thread being replied to must be in the REPLY-blocked state. Any thread in the receiving process is free to reply to the message, however, it may be replied to only once for each receive.

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

The MsgSend*() in the rcvid thread unblocks with a return value of status.


Note: The MsgSend*_r() functions return negative errno values to indicate failure, so you shouldn't pass a negative value for the status to MsgReply*(), because the MsgSend*_r() functions could interpret it as an error code.

The number of bytes transferred is the minimum of that specified by both the replier and the sender. The reply data isn't allowed to overflow the reply buffer area provided by the sender.

The data transfer occurs immediately, and the replying task doesn't block. There's no need to reply to received messages in any particular order, but you must eventually reply to each message to allow the sending thread(s) to continue execution.

Blocking states

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

Native networking

The MsgReply() function has increased latency when it's used to communicate across a network — the server is now writing data to its local lsm-qnet.so, which may need to communicate with the client's lsm-qnet.so to actually transfer the data.

Returns:

The only difference between the MsgReply() and MsgReply_r() functions is the way they indicate errors:

MsgReply()
If an error occurs, -1 is returned and errno is set.
MsgReply_r()
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 buffers.
ESRCH
The thread indicated by rcvid doesn't exist, or is no longer REPLY-blocked on the channel, or the connection is 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

Caveats:

The maximum size for one-part message-pass is 232 − 1 (SSIZE_MAX).

See also:

MsgReceive(), MsgReceivev(), MsgReplyv(), MsgSend(), MsgSendv(), MsgWrite(), MsgWritev()

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/msgreply.html on line 241

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/msgreply.html on line 241