Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

spt_fsyncz(2) OSS System Calls Reference Manual
NAME
spt_fsyncz - Writes modified data and file attributes to permanent storage (thread-aware version)
LIBRARY
H-series and J series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
#include <unistd.h>
#include <spthread.h>
int spt_fsyncz(
int filedes);
PARAMETERS
filedes Specifies an open file descriptor obtained from a successful call to the accept(),
creat(), creat64(), ,dup( ), dup2( ), fcntl(), open(), open64(), pipe(), socket(),
or socketpair() function.
DESCRIPTION
The spt_fsyncz() function is a thread-aware version of the fsync( ) function.
The spt_fsyncz() function saves all modifications for the file open specified by the filedes param-
eter. On return from the spt_fsyncz( ) function, all updated data and file attributes have been
saved on permanent storage.
Use on Guardian Objects
The filedes parameter can specify any regular file in /G including Guardian EDIT files. Time
values are not saved for other file types in /G, such as terminal files.
NOTES
The spt_fsyncz() function offers an alternative to the O_SYNC file status flag. Using
spt_fsyncz() calls gives an application control over the performance tradeoffs involved in
guaranteeing data integrity. OSS file-system caching can be used for files that are protected only
by spt_fsyncz() function calls.
This is a thread-aware function: if this function must wait for an I/O operation to complete on an
open file, this function blocks the thread that called it (instead of the entire process), while it
waits for the I/O operation to complete.
This function serializes file operations on an open file. If a thread calls spt_fsyncz( ) to access a
file that already has a file operation in progress by a different thread, this thread is blocked until
the prior file operation is complete.
For C applications, a macro to map fsync( ) to spt_fsyncz() is available when you use the
#define SPT_THREAD_AWARE_XNONBLOCK preprocessor directive before including
spthread.h or when you use an equivalent compiler command option to compile the application.
For C++ applications, an alias to map fsync() to spt_fsyncz() is available when you use the
#define SPT_THREAD_AWARE_PRAGMA_XNONBLOCK preprocessor directive before
including spthread.h or when you use an equivalent compiler command option to compile the
application.
To use this function in a threaded application that uses the Standard POSIX Threads library on
systems running J06.10 or later RVUs or H06.21 or later RVUs, you must perform all of the fol-
lowing tasks:
Include the spthread.h header file in the application.
Compile the application using the _SPT_MODEL_ feature test macro or equivalent
compiler command option in addition to any other feature test macros in use.
7246 Hewlett-Packard Company 527186-023