dev_read (devno, nchars, min_chars, time, timeout)
A device id number returned from dev_open.
The number of characters to read.
The minimum number of characters to read.
The inter-character time limit.
A timeout value for the entire read.
A buffer containing the characters which were successfully returned from this call, or nil if an error occurred.
This function is a modification of the QNX 4 dev_read function. It is currently only available in QNX 4.
This function does not support the proxy and armed arguments to the C dev_read function. The characters read from the device are returned in a buffer rather than filled in to a buf argument as with the C function. Otherwise, the function of this call is identical to the QNX 4 dev_read function.
The min, time, and timeout values are used as follows:
Table 16. dev_read min, time, and timeout values
min | time | timeout | Description |
---|---|---|---|
0 | 0 | 0 | Returns immediately with as many bytes as are currently available (up to nchars bytes). |
M | 0 | 0 | Return with up to nchars bytes only when at least M bytes are available. |
0 | T | 0 | Return with up to nchars bytes when at least one byte is available, or T * 0.1 sec has expired. |
M | T | 0 | Return with up to nchars bytes when either M bytes are available or at least one bytes has been received and the inter-byte time between any subsequently received characters exceeds T * 0.1 sec. |
0 | 0 | t | Reserved. |
M | 0 | t | Return with up to nchars bytes when t * 0.1 sec has expired, or M bytes are available. |
0 | T | t | Reserved. |
M | T | t | Return with up to nchars when M bytes are available, or t * 0.1 sec has expired and no characters are received, or at least one byte has been received and the inter-byte time between any subsequently received characters exceeds T * 0.1 sec. |
0 | T | t | Reserved. |
M | T | t | Return with up to nchars when M bytes are available, or t * 0.1 sec has expired and no characters are received, or at least one byte has been received and the inter-byte time between any subsequently received characters exceeds T * 0.1 sec. |
If an error occurs the errno is set. The following error constants are relevant:
EAGAIN The O_NONBLOCK flag is set on the devno.
EBADF The devno argument is invalid or not open for read
EINTR The function was interrupted by a signal
EIO The process cannot read data from the devno
ENOSYS This function is not supported for the given devno
Copyright © 1995-2010 by Cogent Real-Time Systems, Inc. All rights reserved.