Updated: October 26, 2022

Verify a client's read access to a resource


#include <sys/iofunc.h>

int iofunc_read_verify( resmgr_context_t* ctp,
                        io_read_t* msg,
                        iofunc_ocb_t* ocb,
                        int* nonblock );


A pointer to a resmgr_context_t structure that the resource-manager library uses to pass context information between functions.
A pointer to the io_read_t structure that contains the message that the resource manager received. For information on this structure, see the Handling the _IO_READ message topic in the Writing a Resource Manager guide.
A pointer to the iofunc_ocb_t structure for the Open Control Block that was created when the client opened the resource.
NULL, or a pointer to a location where the function can store a value that indicates whether or not the device is nonblocking:
  • O_NONBLOCK — the client doesn't want to be blocked.
  • Zero — the client wants to be blocked.



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


The iofunc_read_verify() function checks that the client _IO_READ or _IO_READ64 message is well-formed and the operation should be allowed to succeed. This function may update fields for proper behavior. Optionally, it further reports if the operation may be treated as nonblocking.

All read handlers should start with a call to iofunc_read_verify() and proceed only if it returns EOK.

This function checks at least that:
  • the original open included read access
  • the incoming message is well-formed, including that:
    • if an xtype is specified that includes extra data headers, the extra data is in the receive buffer
  • a readdir message is done only for directories and other message types only for non-directories, that is:
    • if the xtype is _IO_XTYPE_READDIR and the file is not a directory, fail
    • if the xtype is something different but the file is a directory, fail
  • on 32-bit systems, an _IO_READ64 was not sent
  • on regular files on 32-bit filesystems, the offset to be read from does not exceed INT32_MAX
This function updates the following:
  • If a non-NULL nonblock pointer is passed in, the value pointed to will be set to 0 if the operation may be allowed to block, and to O_NONBLOCK if the operation should not be allowed to block.
  • If the read is from a 32-bit filesystem, and the sum of the offset and the number of bytes to read would have exceeded INT32_MAX, then msg->i.nbytes will be reduced such that this sum is exactly INT32_MAX.


The client is allowed to perform this read operation.
The client didn't open the resource for read access.
The message is improperly formatted or doesn't include enough data.
The offset to be read from is greater than INT32_MAX on a 32-bit filesystem and the read is greater than 0 bytes.
The file is a directory and the message was not an _IO_XTYPE_READDIR message.
The file is not a directory but the message was an _IO_XTYPE_READDIR message.
An _IO_READ64 message was received on a 32-bit system.


QNX Neutrino

Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes