Updated: April 19, 2023 |
Read a message from a client, from local data, or both
#include <sys/resmgr.h> ssize_t resmgr_msgget( resmgr_context_t * const ctp, void *msg, size_t size, size_t offset );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The resmgr_msgget() function is a convenience function that you can use in a resource manager instead of resmgr_msgread() or MsgRead().
Based on the requested data offset, this function first copies data from the current local message buffer (if applicable) and then gets the rest of the data (if applicable) from the client by calling MsgRead().
Because combine message offsets are automatically handled, the caller does not add the offset that ctp references to the passed in offset. The passed in offset is just the offset from the start of the current message being processed.
For combine messages (those with the _IO_COMBINE_FLAG set), the amount of data returned to the caller is limited to the size found in the size parameter referenced by ctp. This limit ensures that the caller does not get data from a subsequent message by mistake.
For more information, see Layers in a resource manager in the Bones of a Resource Manager chapter of Writing a Resource Manager.
The number of bytes read, or -1 if an error occurs (errno is set).
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |