HP-UX Reference (11i v1 05/09) - 2 System Calls (vol 5)
r
read(2) read(2)
[EINVAL] The
STREAM or multiplexer referenced by fildes is linked (directly or indirectly)
downstream from a multiplexer.
[EIO] A physical I/O error has occurred.
[EIO] The process is a member of a background process attempting to read from its control-
ling terminal, the process is ignoring or blocking the
SIGTTIN signal or the process
group is orphaned. This error may also be generated for implementation-dependent
reasons.
[EISDIR] The fildes argument refers to a directory and the implementation does not allow the
directory to be read using
read(),
pread() or readv(). The readdir() func-
tion should be used instead.
The
readv() function will fail if:
[EINVAL] The sum of the iov_len values in the iov array overflowed an ssize_t.
The
read(), pread() and readv() functions may fail if:
[ENXIO] A request was made of a non-existent device, or the request was outside the capabili-
ties of the device.
The readv() function may fail if:
[EINVAL] The iovcnt argument was less than or equal to 0, or greater than
{IOV_MAX}.
The
pread() function will fail and the file pointer remains unchanged if:
[EINVAL] The offset argument is invalid. The value is negative.
[EOVERFLOW]
The file is a regular file and an attempt was made to read at or beyond the offset max-
imum associated with the file.
[ESPIPE] fildes is associated with a pipe or FIFO.
SEE ALSO
fcntl(2), ioctl(2), lseek(2), open(2), pipe(2), <stropts.h>, <sys/uio.h>, <unistd.h>, XBD Specification, Chapter
9, General Terminal Interface.
CHANGE HISTORY
First released in Issue 1. Derived from Issue 1 of the SVID.
Issue 4
The following changes are incorporated for alignment with the ISO POSIX-1 standard:
• The type of the argument buf is changed from char * to void*, and the type of the argument nbyte
is changed from unsigned to size_t.
• The DESCRIPTION section now states that the result is implementation-dependent if nbyte is
greater than
{SSIZE_MAX} . This limit was defined by the constant {INT_MAX} in Issue 3.
The following change is incorporated for alignment with the FIPS requirements:
• The last paragraph of the DESCRIPTION section now states that if
read() is interrupted by a
signal after it has successfully read some data, it will return the number of bytes read. In Issue 3
it was optional whether read() returned the number of bytes read, or whether it returned −1
with errno set to [EINTR].
Other changes are incorporated as follows:
• The header <unistd.h> is added to the SYNOPSIS section.
• The DESCRIPTION section is rearranged for clarity and to align more closely with the ISO
POSIX-1 standard. No functional changes are made other than as noted elsewhere in this
CHANGE HISTORY section.
• In the ERRORS section in previous issues, generation of the [EIO] error depended on whether or
not an implementation supported Job Control. This functionality is now defined as mandatory.
• The [ENXIO] error is marked as an extension.
HP-UX 11i Version 1: September 2005 − 3 − Hewlett-Packard Company Section 2−−267