HP-UX Reference (11i v1 00/12) - 2 System Calls (vol 5)
__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man2/!!!intro.2
________________________________________________________________
___ ___
r
read(2) read(2)
[ENOLCK] The system record lock table is full, preventing the read from sleeping until the block-
ing write lock is removed.
In addition, readv() can return one of the following errors:
[EFAULT] iov_base or iov points outside of the allocated address space. The reliable detection of
this error is implementation-dependent.
EXAMPLES
Assuming a process opened a file for reading, the following call to read(2) reads BUFSIZ bytes from the
file into the buffer pointed to by mybuf:
#include <stdio.h> /* include this for BUFSIZ definition */
char mybuf[BUFSIZ];
int nbytes, fildes;
nbytes = read (fildes, mybuf, BUFSIZ);
WARNINGS
Record locking might not be enforced by the system, depending on the setting of the file’s mode bits (see
lockf(2)).
Character-special devices, and raw disks in particular, apply constraints on how
read() can be used. See
the specific Section (7) entries for details on particular devices.
Check all references to signal(5) for appropriateness on systems that support sigvector(2).
sigvector()
can affect the behavior described on this page.
In general, avoid using read() to get the contents of a directory; use the readdir() library routine
(see directory(3C)).
DEPENDENCIES
NFS
When obtaining the contents of a directory on an NFS file system, the
readdir() library routine must
be used (see directory(3C)).
read() returns with an error if used to read a directory using NFS.
AUTHOR
read() was developed by HP, AT&T, and the University of California, Berkeley.
SEE ALSO
creat(2), dup(2), fcntl(2), ioctl(2), lockf(2), open(2), pipe(2), select(2), ustat(2), directory(3C), tty(7).
STANDARDS CONFORMANCE
read(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, POSIX.4
Section 2−−250 − 2 − HP-UX Release 11i: December 2000
___
___