The getsockopt or setsockopt callable service gets or sets options that are associated with a socket.
Operation | Environment |
---|---|
Authorization: | Supervisor state or problem state, any PSW key |
Dispatchable unit mode: | Task or SRB |
Cross memory mode: | PASN = HASN |
AMODE (BPX1OPT): | 31-bit task or SRB mode |
AMODE (BPX4OPT): | 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. |
|
AMODE 64 callers use BPX4OPT with the same parameters.
The name of a fullword that contains the socket file descriptor for which the service is to be performed.
The name of a field that contains the operation option. The value of this field determines whether the service to be performed is getsockopt, setsockopt, or setibmsockopt. See BPXYSOCK — Map SOCKADDR structure and constants for valid Operation values.
The name of a field that contains the level for which the option is set or being set.
The name of a field in which the value of the option name is provided. See BPXYSOCK — Map SOCKADDR structure and constants for valid Option_name values.
The name of a field that contains the length of Option_data. On return from getsockopt, this field contains the size of the data that was returned in Option_data. The size of this field should be less than 4096 bytes (4KB) in length. The size of the buffer specified should be the maximum length that the option_data could be on output.
The name of a field that contains the data that is associated with or is to be associated with the socket. On return from getsockopt, this field contains the data that is associated with the socket. For setsockopt, this field provides the data that is to be associated with the socket.
Return_code | Explanation |
---|---|
EDOM | An argument that is too large was supplied on the call. |
EINVAL | An incorrect argument was supplied on the call. Consult Reason_code to determine the exact reason the error occurred. The following reason code can accompany the return code: JRLevelNotSupp. |
ENOBUFS | A buffer could not be obtained. Consult Reason_code to determine the exact reason the error occurred. The following reason code can accompany the return code: JROutofSocketCells. |
ENOPROTOOPT | An option_name that was specified for getsockopt is not supported. An incorrect value was specified on the Level parameter. SOL_SOCKET must be specified. Consult Reason_code to determine the exact reason the error occurred. The following reason codes can accompany the return code: JRLevelNotSupp, JRInvalOpOpt, JROptNotSupp. |
ENOSYS | For AF_UNIX, setsockopt was specified; it is not supported. Consult Reason_code to determine the exact reason the error occurred. The following reason code can accompany the return code: JRSetNotSupp. |
ENOTSOCK | Socket_descriptor does not refer to a valid socket descriptor. Consult Reason_code to determine the exact reason the error occurred. The following reason code can accompany the return code: JRMustBeSocket. |
The name of a fullword in which the getsockopt or setsockopt service stores the reason code. The getsockopt or setsockopt 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.
There are no restrictions on the use of the getsockopt or setsockopt service.
For an example using this callable service, see BPX1OPT (getsockopt or setsockopt) example.