Function READ

Syntax

read file-descriptor vector start end => effective-count, error

Arguments and values

file-descriptor -- A non-negative fixnum.

vector -- A vector with element-type (unsigned-byte 8).

start -- A non-negative fixnum.

end -- A non-negative fixnum.

effective-count -- A non-negative fixnum.

error -- A fixnum.

Description

The function read attempts to read up to end - start bytes from the file descriptor file-descriptor, filling the corresponding indices in vector with the bytes read.

Errors

+eagain+ file-descriptor refers to a file other than a socket and has been marked nonblocking (+o-nonblock+), and the read would block.
+eagain+ or +ewouldblock+ file-descriptor refers to a socket and has been marked nonblocking (+o-nonblock+), and the read would block. POSIX.1-2001 allows either error to be returned for this case, and does not require these constants to have the same value, so a portable application should check for both possibilities.
+ebadf+ file-descriptor is not a valid file descriptor or is not open for reading.
+eintr+ The call was interrupted by a signal before any data was read; see signal(7).
+einval+ file-descriptor is attached to an object which is unsuitable for reading; or the file was opened with the +o-direct+ flag, and either the address specified in buf, the value specified in count, or the current file offset is not suitably aligned.
+einval+ file-descriptor was created via a call to timerfd-create and the wrong size buffer was given to read; see timerfd-create for further information.
+eio+ I/O error. This will happen for example when the process is in a background process group, tries to read from its controlling tty, and either it is ignoring or blocking SIGTTIN or its process group is orphaned. It may also occur when there is a low-level I/O error while reading from a disk or tape.
+eisdir+ file-descriptor refers to a directory.

Other errors may occur, depending on the object connected to file-descriptor. POSIX allows a read that is interrupted after reading some data to return -1 (with errno set to +eintr+) or to return the number of bytes already read.