Open System Services System Calls Reference Manual (G06.28+, H06.05+)

System Functions (s and S) spt_readx(2)
NAME
spt_readx - Reads from a le (thread-aware version)
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
[#include <sys/types.h>]
[#include <unistd.h>]
#include <spthread.h>
ssize_t spt_readx (
int ledes,
void *buffer,
size_t nbytes
);
PARAMETERS
filedes Species an open le descriptor obtained from a successful call to the
spt_acceptx(), creat(), dup(), spt_dup2x( ), spt_fcntlx(), open(),
pipe(), socket(),orsocketpair() function.
buffer Points to the buffer to receive data read.
nbytes Species the number of bytes to read from the le associated with the
ledes parameter.
If the value of nbytes is 0 (zero), the spt_readx() function returns 0
(zero). There are no other results.
If the value of nbytes is greater than SSIZE_MAX, the read() function
returns -1 and sets errno to [EINVAL].
DESCRIPTION
The spt_readx() function is the thread-aware version of the read() function.
The spt_readx() function attempts to read nbytes bytes of data from the le associated with the
ledes parameter into the buffer pointed to by the buffer parameter.
On regular les and devices capable of seeking, the spt_readx() function starts at a position in
the le given by the le pointer associated with the ledes parameter. Upon return from the
spt_readx() function, the le pointer is incremented by the number of bytes actually read.
Devices that are incapable of seeking always read from the current position. For such devices,
the value of the le pointer after a call to the spt_readx() function is always 0 (zero).
Upon successful completion, the spt_readx() function returns the number of bytes actually read
and placed in the buffer. This number is never greater than the value of the nbytes parameter.
The value returned can be less than nbytes if the number of bytes left in the le is less than
nbytes, if the spt_readx() request was interrupted by a signal, or if the le is a pipe, FIFO le, or
special le and has fewer than nbytes bytes immediately available for reading. For example, an
spt_readx() from a le associated with a terminal might return one typed line of data.
No data transfer occurs past the current end-of-le (EOF). If the starting position is at or after the
end-of-le, 0 (zero) is returned.
If an spt_writex() or spt_writevx() call contains so much data that the le system needs to
resize a pipe or FIFO buffer, a read from that pipe or FIFO le can return up to 52 kilobytes of
527186-007 Hewlett-Packard Company 7263