readv (BPX1RDV, BPX4RDV) — Read data and store it in a set of buffers

Function

The readv callable service reads data and stores it in a set of buffers.

Requirements

Operation Environment
Authorization: Supervisor state or problem state, any PSW key
Dispatchable unit mode: Task

SRB - AF_INET/AF_INET6 socket support only

Cross memory mode: PASN = HASN
AMODE (BPX1RDV): 31-bit Start of changetask or SRB modeEnd of change
AMODE (BPX4RDV): 64-bit task mode only
ASC mode: Primary mode
Interrupt status: Enabled for interrupts
Locks: Unlocked
Control parameters: All parameters must be addressable by the caller and in the primary address space.

Format

CALL BPX1RDV,(File_descriptor,
              Iov_count,
              Iov_struct,
              Iov_alet,
              Iov_buffer_alet,
              Return_value,
              Return_code,
              Reason_code)

AMODE 64 callers use BPX4RDV with the same parameters. All addresses in parameter structures are doublewords.

Parameters

File_descriptor
Supplied parameter
Type:
Integer
Length:
Fullword

The name of a fullword that contains the file descriptor for which the readv request is to be done.

Iov_count
Supplied and returned parameter
Type:
Integer
Length:
Fullword

The name of a field that contains the number of buffers that are pointed to by Iov_struct. The total number of buffers may not exceed IOV_MAX (defined in BPXYIOV — Map the I/O vector structure).

Iov_struct
Supplied parameter
Type:
Structure
Length:
Iov_count times length(iov)

The name of a field that contains 31(64)-bit pointers to buffers in which data is to be stored, and their lengths. In 64-bit mode, Iov_struct contains doubleword pointer and length subfields. See BPXYIOV — Map the I/O vector structure for more information.

Iov_alet
Supplied parameter
Type:
Integer
Length:
Fullword

The name of a field that contains the ALET for Iov_struct.

Iov_buffer_alet
Supplied parameter
Type:
Integer
Length:
Fullword

The name of a field that contains the ALET for buffers that are pointed to by Iov_struct.

Return_value
Returned parameter
Type:
Integer
Length:
Fullword
The name of a fullword in which the readv service returns one of the following:
  • The number of bytes that were read into the buffers, if the request is successful.
  • -1, if the request is not successful.
Return_code
Returned parameter
Type:
Integer
Length:
Fullword
The name of a fullword in which the readv service stores the return code. The readv service returns Return_code only if Return_value is -1. See z/OS UNIX System Services Messages and Codes for a complete list of possible return code values. The readv service can return one of the following values in the Return_code parameter:
Return_code Explanation
EAGAIN The file was opened with the nonblock option, and data is not available to be read.
EBADF An incorrect file descriptor was specified. The following reason codes can accompany the return code: JRFileDesNotInUse, JRFileNotOpen.
EINTR A signal interrupted the readv function before any data was available. The following reason code can accompany the return code: JRSockRdwrSignal.
EINVAL The socket is marked shutdown for read; or an incorrect length was specified in the iov. The following reason codes can accompany the return code: JRSocketClosed, JRSocketCallParmError.
EIO The process is in a background process group, and is attempting to read from its controlling terminal. However, TOSTOP is set, the process is neither ignoring nor blocking SIGTTOU signals, and the process group of the process is orphaned. This can happen, for example, if a background job tries to write to the terminal after the user has logged off.
ENOBUFS A buffer could not be obtained. The following reason code can accompany the return code: JROutofSocketCells.
EWOULDBLOCK
  • The socket is marked nonblocking and no data is waiting to be read, or the SO_RCVTIMEO timeout value was reached before data was available.
  • The socket is marked blocking, and the call has blocked for that time period which was specified in the SO_RCVTIMEO option without receiving any data.

The following reason code can accompany the return code: JRTimeout.

Reason_code
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the readv service stores the reason code. The readv service returns Reason_code only if Return_value is -1. Reason_code further qualifies the Return_code value. For the reason codes, see z/OS UNIX System Services Messages and Codes.

Usage notes

Related services

Characteristics and restrictions

There are no restrictions on the use of the readv service.

Examples

For an example using this callable service, see BPX1RDV (readv) example.