fsync (BPX1FSY, BPX4FSY) — Write changes to permanent storage

Function

The fsync callable service writes changes on the permanent storage device that holds the file.

Requirements

Operation Environment
Authorization: Supervisor state or problem state, any PSW key
Dispatchable unit mode: Task
Cross memory mode: PASN = HASN
AMODE (BPX1FSY): 31-bit
AMODE (BPX4FSY): 64-bit
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 BPX1FSY,(File_descriptor,
              Return_value,
              Return_code,
              Reason_code)

AMODE 64 callers use BPX4FSY with the same parameters.

Parameters

File_descriptor
Supplied parameter
Type:
Integer
Length:
Fullword

The name of a fullword that contains the file descriptor of the file for which changes are to be written to permanent storage.

Return_value
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the fsync service returns 0 if the request is successful, or -1 if it is not successful.

Return_code
Returned parameter
Type:
Integer
Length:
Fullword
The name of a fullword in which the fsync service stores the return code. The fsync 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 fsync service can return one of the following values in the Return_code parameter:
Return_code Explanation
EBADF The File_descriptor parameter does not specify a valid, open file.
EINVAL The file is not a regular file.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the fsync service stores the reason code. The fsync 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. The fsync service causes all modified data in the specified file to be written to the permanent storage device that holds the file. On return from a successful call, all updates have been saved on the permanent storage device that holds the file.
  2. If the file represented by the file_descriptor was opened with synchronous updates specified, there is no need to use the fsync callable service, because each write causes all updates to be written to permanent storage.

Related services

Characteristics and restrictions

The file identified by File_descriptor must be open for writing when the fsync service is called.

Start of changeWhen automatic conversion is enabled, a fsync operation cannot write to permanent storage an untranslated partial character that was cached by z/OS®. Untranslated partial characters occur when translating multibyte characters sets and z/OS is given data that does not end on a character boundary. Untranslated partial characters are resolved during a subsequent write operation (BPX1WRT/BPX4WRT) when the remaining part of the character is supplied.End of change

Examples

For an example using this callable service, see BPX1FSY (fsync) example.