#include <unistd.h> #include <sys/types.h> #include <sys/uio.h> #include <sys/sendv.h>
off_t sendv(int fd, struct sendv_iovec *iov, int iovcnt);
off64_t sendv64(int fd, struct sendv_iovec64 *iov, int iovcnt);
The iov argument points to an array of structures; each structure describes one write operation. For sendv, the iov argument points to a sendv_iovec structure that contains the following members:
off_t sendv_off; /* starting offset */ off_t sendv_len; /* length to send */ void *sendv_base; /* default source */ uint_t sendv_flags; /* SENDV_* flag bits */ int sendv_fd; /* source (not sendv_base) when SENDV_FD */
For sendv64, the iov argument points to a sendv_iovec64 structure that contains the following members:
off64_t sendv_off; /* starting offset */ off64_t sendv_len; /* length to send */ void *sendv_base; /* default source */ uint_t sendv_flags; /* SENDV_* flag bits */ int sendv_fd; /* source (not sendv_base) when SENDV_FD */
The size of the regular file specified by the
element can be up to 2 gigabytes in size for sendv, and up to
1 terabyte for sendv64.
Otherwise, the two calls are identical.
The value of
sendv_flags specifies whether the source
is an open file descriptor or a buffer in user memory.
sendv_flags can be set to:
SENDV_FDis set in
sendv_flags, sendv and sendv64 attempt to write
sendv_lenbytes starting at offset
sendv_offin the file specified by
sendv_fdto the stream associated with fd.
SENDV_FD is not set, sendv and sendv64
attempt to write
sendv_len bytes from the buffer pointed to
sendv_base to the stream associated with fd.
Both calls process sendv_iovec entries sequentially.
errnois not set.
If an error occurs and no data has been written,
``-1'' is returned and
errno is set as shown below.
sendv_fdis not a valid file descriptor or is not open for reading.
sendv_fdand cause a deadlock to occur.
sendv_basepoints outside the process's allocated address space.
sendv_lenis less than 0.
sendv_lenvalues in the iov array was greater than the largest valid integer value (overflow).
sendv_flagswas set to an invalid value.
sendv_fdis not a regular file.
sendv_offis greater than the current size of the file referenced by
sendv_fd, so the call could not go to sleep until the blocking record lock was removed.
sendv_fdis on a remote machine and the link to that machine is no longer active.
sendv_fdis a regular file,
sendv_lenis greater than 0, the starting position is before the end-of-file and the starting position is greater than or equal to the offset maximum established in the open file descriptor associated with
sendv_fd. There is no data transfer.
sendv_lenoutside the specified minimum and maximum write range, and the minimum value is non-zero.
A write to a STREAMS file can fail if an error message has been received at the stream head. In this case, errno is set to the value included in the error message.
sendv_fdmust be a regular file, and fd must be a stream.
While one thread is blocked, siblings might still be executing.