The I_NREAD ioctl (streamio(7I)) is an informational ioctl that counts the data bytes as well as the number of messages in the stream head read queue. The number of data bytes is returned in the location pointed to by the arg parameter of the ioctl. The number of messages in the stream head read queue is returned as the return value of the ioctl.
Like FIONREAD, the arg parameter to the I_NREAD ioctl should be a pointer to an int, not a long. And, like FIORDCHK, the return value is constrained to be less than or equal to MAXINT bytes, even if more data is available.