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

System Functions (s and S) spt_lseekz(2)
NAME
spt_lseekz - Sets file offset for read or write operation (serializes I/O operations on an open file))
LIBRARY
H-series and J series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
#include <sys/types.h> /* optional except for POSIX.1 */
#include <unistd.h>
#include <spthread.h>
off_t spt_lseekz(
int filedes,
off_t offset,
int whence);
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.
offset Specifies a value, in bytes, that is used with the whence parameter to set the file
pointer. A negative value causes seeking in the reverse direction.
whence Specifies how to interpret the offset parameter in setting the file pointer associ-
ated with the filedes parameter. Values for the whence parameter are:
SEEK_CUR Sets the file pointer to its current location plus the value of the
offset parameter.
SEEK_END Sets the file pointer to the size of the file plus the value of the
offset parameter.
SEEK_SET Sets the file pointer to the value of the offset parameter.
DESCRIPTION
The spt_lseekz() is a thread-aware version of the lseek() function.
The spt_lseekz() function sets the file offset for the open file specified by the filedes parameter.
The whence parameter determines how the offset is to be interpreted.
The spt_lseekz() function allows the file offset to be set beyond the end of existing data in the
file. If data is later written at this point, subsequent reading of data in the gap returns bytes with
the value 0 (zero) until data is actually written into the gap.
The spt_lseekz() function does not, by itself, extend the size of the file.
NOTES
The spt_lseekz() function offers an alternative to the O_SYNC file status flag. Using
spt_lseekz() 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_lseekz() function calls.
This function serializes file operations on an open file. If a thread calls spt_lseekz() 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.
527186-023 Hewlett-Packard Company 7293