read(3)
DESCRIPTION
Reads up to length bytes at the descriptor's current position into buffer. The position advances by the number of bytes read; zero is a successful end-of-file or empty-pipe result.
SYNOPSIS
#include <unistd.h> long read(int fd, void *buffer, unsigned long length);
RETURN VALUE
- Returns the byte count, possibly less than length, or -1 and sets errno.
ERRORS
-EBADF- Fd does not refer to an open descriptor.
-EFAULT- Buffer is not accessible for length bytes.
-EIO- The underlying file or device reports an I/O failure.
NOTES
The synchronous libc call is implemented as one OP_READ submission on the process AIO ring. Pipe reads can wait for data.