Saturday, February 18, 2012

readv linux


readv writev:
This function is known as scatter read write function. They are designated that way because these functions can read into from many buffers in one atomic operation. The function prototypes for these functions are provided as follows:

#include <sys/uio.h>
int readv(int fd, const struct iovec *vector, int count);

These functions take three arguments, which are
  • The file descriptor fd to read or write upon. 
  • The I/O vector (vector) to use for reading or writing.
  • The number of vector elements (count) to use.
The return value for these functions are the number of bytes read for readv(2). If an error occurs, -1 is returned and errno holds the error code for the failure. Note that like other I/O functions, the error EINTR can be returned to indicate that it was interrupted by a signal.

See Also:

No comments:

Post a Comment