Open System Services System Calls Reference Manual (G06.28+, H06.05+)

System Functions (k - m) lseek64(2)
NAME
lseek64 - Sets le offset for read or write operation
LIBRARY
G-series native OSS processes: system library
H-series OSS processes: implicit libraries
SYNOPSIS
#include <sys/types.h> /* optional except for POSIX.1 */
#include <unistd.h>
off64_t lseek64(
int ledes,
off64_t offset,
int whence);
PARAMETERS
filedes Species an open le descriptor obtained from a successful call to the accept(),
creat(), creat64(), dup( ), dup2(), fcntl( ), open(), open64(), pipe(), socket(),
or socketpair() function.
offset Species a value, in bytes, that is used with the whence parameter to set the le
pointer. A negative value causes seeking in the reverse direction.
whence Species how to interpret the offset parameter in setting the le pointer associ-
ated with the ledes parameter. Values for the whence parameter are:
SEEK_CUR Sets the le pointer to its current location plus the value of the
offset parameter.
SEEK_END Sets the le pointer to the size of the le plus the value of the
offset parameter.
SEEK_SET Sets the le pointer to the value of the offset parameter.
DESCRIPTION
The lseek64() function is similar to the lseek() function except that, in addition to supporting
smaller les, the lseek64() function supports OSS les larger than approximately 2 gigabytes.
An application can explicitly call this function you compile the application using the #dene
_LARGEFILE64_SOURCE 1 feature test macro or an equivalent compiler command option.
An application call to lseek() is automatically mapped to this function when you compile the
application using the #dene _FILE_OFFSET_BITS 64 feature test macro or an equivalent
compiler command option.
The lseek64() function sets the le offset for the open le specied by the ledes parameter. The
whence parameter determines how the offset is to be interpreted.
The lseek64() function allows the le offset to be set beyond the end of existing data in the le.
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 lseek64() function does not, by itself, extend the size of the le.
RETURN VALUES
Upon successful completion, the resulting pointer location, measured in bytes from the beginning
of the le, is returned. For First-in, First-out (FIFO) les, pipes, and character special les, the
value 0 (zero) is returned. For character special les, errno is not set.
527186-007 Hewlett-Packard Company 427