HELPLIB.HLB  —  CRTL  writev
    Writes to a file.

    Format

      #include  <uio.h>

      ssize_t writev  (int file_desc, const struct iovec *iov, int
                      iovcnt);

      ssize_t __writev64  (int file_desc, const struct
                          __iovec64  *iov, int iovcnt);
                          (Integrity servers, Alpha)

1  –  Function Variants

    The writev function has variants named _writev32 and __writev64
    for use with 32-bit and 64-bit pointer sizes, respectively.

2  –  Arguments

 file_desc

    A file descriptor that refers to a file currently opened for
    writing or updating.

 iov

    Array of iovec structures from which the output data is gathered.

 iovcnt

    The number of buffers specified by the members of the iov array.

3  –  Description

    The writev function is equivalent to write but gathers the output
    data from the iovcnt buffers specified by the members of the iov
    array: iov[0], iov[1], ..., iov[iovcnt-1]. The iovcnt argument
    is valid if greater than 0 and less than or equal to {IOV_MAX},
    defined in <limits.h>.

    Each iovec entry specifies the base address and length of an area
    in memory from which data should be written. The writev function
    writes a complete area before proceeding to the next.

    If filedes refers to a regular file and all of the iov_len
    members in the array pointed to by iov are 0, writev returns 0
    and has no other effect.

    For other file types, the behavior is unspecified.

    If the sum of the iov_len values is greater than SSIZE_MAX, the
    operation fails and no data is transferred.

    Upon successful completion, writev returns the number of bytes
    actually written. Otherwise, it returns a value of -1, the file
    pointer remains unchanged, and errno is set to indicate an error.

4  –  Return Values

    x                  The number of bytes written.
    -1                 Indicates an error. The file times do not
                       change, and the function sets errno to one of
                       the following values:

                       o  EBADF - The file_desc argument is not a
                          valid file descriptor open for writing.

                       o  EINTR - The write operation was terminated
                          due to the receipt of a signal, and no data
                          was transferred.

                       o  EINVAL - The sum of the iov_len values in
                          the iov array would overflow an ssize_t, or
                          the iovcnt argument was less than or equal
                          to 0, or greater than {IOV_MAX}.

                       o  EIO - A physical I/O error has occurred.

                       o  ENOSPC - There was no free space remaining
                          on the device containing the file.

                       o  EPIPE - An attempt is made to write to a
                          pipe or FIFO that is not open for reading
                          by any process, or that only has one end
                          open. A SIGPIPE signal will also be sent to
                          the thread.
Close Help