Library /sys$common/syshlp/helplib.hlb  —  CRTL  readv
    Reads from a file.

    This function is supported on OpenVMS Integrity servers and
    Alpha only.

    Format

      #include  <sys/uio.h>

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

      ssize_t _readv64  (int file_desc, struct __iovec64 *iov, int iovcnt);

1  –  Function Variants

    The readv function has variants named _readv32 and _readv64 for
    use with 32-bit and 64-bit pointer sizes, respectively.

2  –  Arguments

 file_desc

    A file descriptor. A file descriptor that must refer to a file
    currently opened for reading.

 iov

    Array of iovec structures into which the input data is placed.

 iovcnt

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

3  –  Description

    The readv function is equivalent to read, but places the input
    data into the iovcnt buffers specified by the members of the iov
    array: iov[0], iov[1], ..., iov[iovcnt-1]. The iovcnt argument is
    valid if it is greater than 0 and less than or equal to IOV_MAX.

    Each iovec entry specifies the base address and length of an area
    in memory where data should be placed. The readv function always
    fills an area completely before proceeding to the next.

    Upon successful completion, readv marks for update the st_atime
    field of the file.

    If the Synchronized Input and Output option is supported:

          If the O_DSYNC and O_RSYNC bits have been set, read
          I/O operations on the file descriptor will complete
          as defined by synchronized I/O data integrity
          completion.

          If the O_SYNC and O_RSYNC bits have been set, read
          I/O operations on the file descriptor will complete
          as defined by synchronized I/O file integrity
          completion.

    If the Shared Memory Objects option is supported:

          If file_desc refers to a shared memory object, the
          result of the read function is unspecified.

    For regular files, no data transfer occurs past the offset
    maximum established in the open file description associated with
    file_desc.

4  –  Return Values

    n                  The number of bytes read.
    -1                 Indicates a read error. The function sets
                       errno to one of the following values:

                       o  EAGAIN - The O_NONBLOCK flag is set for the
                          file descriptor, and the process would be
                          delayed.

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

                       o  EBADMSG - The file is a STREAM file that is
                          set to control-normal mode, and the message
                          waiting to be read includes a control part.

                       o  EINTER - The read operation was terminated
                          because of the receipt of a signal, and no
                          data was transferred.

                       o  EINVAL - The STREAM or multiplexer
                          referenced by file_desc is linked
                          (directly or indirectly) downstream from
                          a multiplexer.

                          OR

                          The sum of the iov_len values in the iov
                          array overflowed an ssize_t.

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

                          OR

                          The process is a member of a background
                          process attempting to read from its
                          controlling terminal, the process is
                          ignoring or blocking the SIGTTIN signal,
                          or the process group is orphaned.

                       o  EISDIR - The file_desc argument refers to a
                          directory, and the implementation does not
                          allow the directory to be read using read,
                          pread or readv. Use the readdir function
                          instead.

                       o  EOVERFLOW - The file is a regular file,
                          nbyte is greater than 0, and the starting
                          position is before the end-of-file and is
                          greater than or equal to the offset maximum
                          established in the open file description
                          associated with file_desc.

                       The readv function may fail if:

                       o  EINVAL - The iovcnt argument was less than
                          or equal to 0, or greater than IOV_MAX.
Close Help