Rev | Author | # | Line |
---|---|---|---|
1 | perry | 1 | !!NAME |
2 | PerryLorier | 2 | readv, writev - read or write a vector |
1 | perry | 3 | |
4 | !!SYNOPSIS | ||
2 | PerryLorier | 5 | __#include <sys/uio.h>__ |
1 | perry | 6 | |
2 | PerryLorier | 7 | __int readv(int__ ''fd''__, const struct iovec *__ ''vector''__, int__ ''count''__);__ |
1 | perry | 8 | |
2 | PerryLorier | 9 | __int writev(int__ ''fd''__, const struct iovec *__ ''vector''__, int__ ''count''__);__ |
1 | perry | 10 | |
2 | PerryLorier | 11 | __struct iovec {__ |
12 | ptr_t__ ''iov_base''__;__ /* Starting address. */__ | ||
13 | size_t__ ''iov_len''__;__ /* Length in bytes. */__ | ||
14 | __};__ | ||
1 | perry | 15 | |
16 | !!DESCRIPTION | ||
2 | PerryLorier | 17 | readv(2) reads data from file descriptor ''fd'', and puts the result in the buffers described by ''vector''. The number of buffers is specified by ''count''. The |
18 | buffers are filled in the order specified. Operates just like __read__ except that data is put in ''vector'' instead of a contiguous buffer. | ||
1 | perry | 19 | |
2 | PerryLorier | 20 | __writev__ writes data to file descriptor ''fd'', and from the buffers described by ''vector''. The number of buffers is specified by ''count''. The buffers are used |
21 | in the order specified. Operates just like __write__ except that data is taken from ''vector'' instead of a contiguous buffer. | ||
1 | perry | 22 | |
23 | !!RETURN VALUE | ||
2 | PerryLorier | 24 | On success __readv__ returns the number of bytes read. On success __writev__ returns the number of bytes written. On error, -1 is returned, and ''errno'' is set appropriately. |
1 | perry | 25 | |
26 | !!ERRORS | ||
2 | PerryLorier | 27 | ;[EINVAL]: An invalid argument was given. For instance ''count'' might be greater than __MAX_IOVEC__, or zero. ''fd'' could also be attached to an object which is unsuitable for reading (for __readv__) or writing (for __writev__). |
28 | ;[EFAULT]: vector'' or some of the ''iov_base'' pointers points to memory that is not properly allocated. | ||
29 | ;[EBADF]: The file descriptor ''fd'' is not valid. | ||
30 | ;[EINTR]: The call was interrupted by a signal before any data was read/written. | ||
31 | ;[EAGAIN]: Non-blocking I/O has been selected using __O_NONBLOCK__ and no data was immediately available for reading. (Or the file descriptor ''fd'' is for an object that is locked.) | ||
32 | ;[EISDIR]: ''fd'' refers to a directory. | ||
33 | ;[EOPNOTSUP]: ''fd'' refers to a socket or device that does not support reading/writing. | ||
34 | ;[ENOMEM]: Insufficient kernel memory was available. | ||
1 | perry | 35 | |
2 | PerryLorier | 36 | Other errors may occur, depending on the object connected to ''fd''. |
1 | perry | 37 | |
38 | !!CONFORMING TO | ||
2 | PerryLorier | 39 | 4.4BSD (the __readv__ and __writev__ functions first appeared in BSD 4.2), Unix98. Linux libc5 uses __size_t__ as the type of the ''count'' parameter, which is logical |
40 | but non-standard. | ||
1 | perry | 41 | |
42 | !!SEE ALSO | ||
2 | PerryLorier | 43 | read(2), write(2), fprintf(3), fscanf(3) |
lib/blame.php:177: Warning: Invalid argument supplied for foreach() (...repeated 7 times)