The close callable service closes a file. You identify the file by its file descriptor.
Operation | Environment |
---|---|
Authorization: | Supervisor state or problem state, any PSW key |
Dispatchable unit mode: | Task or SRB. If SRB, AF_INET/AF_INET6 socket support only |
Cross memory mode: | PASN = HASN |
AMODE (BPX1CLO): | 31-bit task or SRB mode |
AMODE (BPX4CLO): | 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 BPX4CLO with the same parameters.
The name of a fullword containing the file descriptor of the file or socket the caller wants closed. The file descriptor is returned by the open service (see open (BPX1OPN, BPX4OPN) — Open a file) or by the socket service (see socket or socketpair (BPX1SOC, BPX4SOC) — Create a socket or a pair of sockets).
The name of a fullword in which the close service returns 0 if the request is successful, or -1 if it is not successful.
Return_code | Explanation |
---|---|
EAGAIN | The service did not complete, because the file descriptor specified is currently in use by another thread in the same process. |
EBADF | The File_descriptor does not identify a valid, open file. The following reason codes can accompany the return code: JRClNeedClose and JRNotForDir. |
EINTR | The service was interrupted by a signal while it was processing the close request. The file may or may not be closed. |
The name of a fullword where the close service stores the reason code. The close 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 close service.
For an example using this callable service, see BPX1CLO (close) example.