Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

writev - write to file

&pagelevel(4)&pagelevel

Syntax

#include <sys/uio.h>

ssize_t writev(int fildes, const struct iovec *iov, size_t nbyte);

Description

writev() does the same as write(), but collects the output data of the iovcnt buffers that are defined by the members of the iov fields (iov[0], iov[1], ..., iov[iovcnt-1]). The following must apply: 0 < iovcntIOV_MAX.

For writev() the iovec structure contains the following elements:

caddr_t iov_base;
int     iov_len;

Each iovec entry specifies the basic address and the length of the memory area from which the data is to be written. writev() always fills a whole area before proceeding to the next one.

If fildes identifies a regular file and all elements of the iov field have the value 0, writev() returns the value 0 and has no other effect.

If the sum of the iov_len values exceeds SSIZE_MAX, writev() fails and no data is transferred.

For more details, see write().

Return val.

Number of bytes actually written


if successful.

-1

otherwise. In this case the file pointer is not changed. errno is set to
indicate the error.

Errors

see write(). addition to the errors specified there, writev() will fail if:


EINVAL

iovcnt was less than or equal to 0 or greater than or equal to 16, or one of the iov_len values in the iov field was negative, or the sum of the iov_len values in the iov field creates an overflow in the case of a 32-bit integer.


EINVAL

fildes is assigned to a BS2000 file.


writev() will also fail if an asynchronous error message appears at the STREAM head before the call. In this case, the value of errno does not refer to writev(), but to the previous STREAM error.

See also

chmode(), creat(), dup(), fcntl(), getrlimit(), lseek(), open(), pipe(), ulimit(), limits.h, stropts.h, sys/uio.h, unistd.h.