@comment The start of a function description is indicated by the following @comment comment. This syntax is used by the script functxh.sh: @comment @comment function @comment function writev @node writev, io @findex writev @subheading Syntax @example #include ssize_t writev (int fd, const struct iovec *iov, int iovcnt); @end example @subheading Description @code{writev()} performs a scatter-gather write to the specified file descriptor @var{fd}. A group of buffers described by the array @var{iov}, with @var{iovcnt} entries, is written to @var{fd} in a similar way to @code{write()} (@pxref{write, , write, libc}). @code{struct iovec} is defined as follows: @example struct iovec @{ void *iov_base; /* Base address of a memory region for I/O */ size_t iov_len; /* Size of memory region */ @}; @end example @subheading Return Value On successful completion the function returns the number of bytes written. Otherwise, a value of -1 is returned and @var{errno} is set appropriately. @table @samp @item EINVAL One of the following conditions is true: @itemize @bullet @item The total length to write would overflow a @samp{ssize_t}. @item @var{iovcnt} was negative, zero or larger than @code{IOV_MAX}. @end itemize @end table @subheading Portability @portability posix, unix98 @subheading Example @example @end example