shutdown (BPX1SHT, BPX4SHT) — Shut down all or part of a duplex socket connection

Function

The shutdown callable service shuts down all or part of a duplex socket connection.

Requirements

Operation Environment
Authorization: Supervisor state or problem state, any PSW key
Dispatchable unit mode: Task or SRB
Cross memory mode: PASN = HASN
AMODE (BPX1SHT): 31-bit Start of changetask or SRB modeEnd of change
AMODE (BPX4SHT): 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 BPX1SHT,(Socket_descriptor,
              How,
              Return_value,
              Return_code,
              Reason_code)

AMODE 64 callers use BPX4SHT with the same parameters.

Parameters

Socket_descriptor
Supplied parameter
Type:
Integer
Length:
Fullword

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

How
Supplied parameter
Type:
Integer
Length:
Fullword
The name of a field that contains the condition of the shutdown:
  • 0 ends communication from Socket (Read).
  • 1 ends communication to Socket (Write).
  • 2 ends communication both to and from Socket.
Return_value
Returned parameter
Type:
Integer
Length:
Fullword
The name of a fullword in which the shutdown service returns one of the following:
  • 0 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 shutdown service stores the return code. The shutdown 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 shutdown service can return one of the following values in the Return_code parameter:
Return_code Explanation
EBADF An incorrect file descriptor was supplied. The following reason codes can accompany the return code: JRFileDesNotInUse, JRFileNotOpen.
EINVAL The How parameter is incorrect. It is not 0, 1, or 2. The following reason code can accompany the return code: JRBadEntryCode.
ENOBUFS A buffer could not be obtained. The following reason code can accompany the return code: JROutofSocketCells.
ENOTSOCK Socket_descriptor does not refer to a valid socket descriptor. The following reason code can accompany the return code: JRMustBeSocket.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the shutdown service stores the reason code. The shutdown 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

  1. Start of change See Callable services available to SRB mode routines for more information about programming considerations for SRB mode.End of change
  2. A shutdown for read means that future write operations from the other end of this socket are rejected. Any data that was already written before the shutdown occurred are available for the application that issued the shutdown to read. The data is read until a read is done that returns zero bytes, indicating that there is no more data for that socket.
  3. A shutdown for write means that any future writes by the application that issued the shutdown request are rejected.
  4. Regardless of the How option specified, reads are not rejected.

Characteristics and restrictions

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

Examples

For an example using this callable service, see BPX1SHT (shutdown) example.