Reads up to count bytes into buf from fd.
- fd
- Documentation for this section has not yet been entered.
- buf
- Documentation for this section has not yet been entered.
- count
- Documentation for this section has not yet been entered.
If successful, the number of bytes actually read is returned. Upon reading end-of-file, zero is returned. Otherwise, a -1 is returned and the global variable Stdlib.GetLastError is set to indicate the error.
Usage
The read(), readv(), and pread() system calls will succeed unless:
Error Details Errno.EBADF The d argument is not a valid file or socket descriptor open for reading.
Errno.EFAULT The buf argument points outside the allocated address space.
Errno.EIO An I/O error occurred while reading from the file system.
Errno.EINTR A read from a slow device was interrupted before any data arrived by the delivery of a signal.
Errno.EINVAL The pointer associated with d was negative.
Errno.EAGAIN The file was marked for non-blocking I/O, and no data were ready to be read.
Errno.EISDIR The file descriptor is associated with a directory residing on a file system that does not allow regular read operations on directories (e.g. NFS).
Errno.EOPNOTSUPP The file descriptor is associated with a file system and file type that do not allow regular read operations on it.
Errno.EOVERFLOW The file descriptor is associated with a regular file, nbytes is greater than 0, offset is before the end-of-file, and offset is greater than or equal to the offset maximum established for this file system.
In addition, readv() may return one of the following errors:
Error Details Errno.EINVAL The iovcnt argument was less than or equal to 0, or greater than TODO.IOV_MAX .
Errno.EINVAL One of the iov_len values in the iov array was negative.
Errno.EINVAL The sum of the iov_len values in the iov array overflowed a 32-bit integer.
Errno.EFAULT Part of the iov points outside the process's allocated address space.
The pread() system call may also return the following errors:
Error Details Errno.EINVAL The offset value was negative.
Errno.ESPIPE The file descriptor is associated with a pipe, socket, or FIFO.
The read() system call attempts to read nbytes of data from the object referenced by the descriptor d into the buffer pointed to by buf . The readv() system call performs the same action, but scatters the input data into the iovcnt buffers specified by the members of the iov array: iov[0], iov[1], ..., iov[iovcnt|-|1]. The pread() system call performs the same function, but reads from the specified position in the file without modifying the file pointer.
For readv(), the iovec structure is defined as:
Usage
struct iovec {
};
Each iovec entry specifies the base address and length of an area in memory where data should be placed. The readv() system call will always fill an area completely before proceeding to the next.
On objects capable of seeking, the read() starts at a position given by the pointer associated with d (see Syscall.lseek(2) ) . Upon return from read(), the pointer is incremented by the number of bytes actually read.
Objects that are not capable of seeking always read from the current position. The value of the pointer associated with such an object is undefined.
Upon successful completion, read(), readv(), and pread() return the number of bytes actually read and placed in the buffer. The system guarantees to read the number of bytes requested if the descriptor references a normal file that has that many bytes left before the end-of-file, but in no other case.
Namespace: Mono.Unix.Native
Assembly: Mono.Posix (in Mono.Posix.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0