lseek(2) DG/UX 4.30 lseek(2)
NAME
lseek - Change object pointer's current position.
SYNOPSIS
#include <sys/file.h>
#include <sys/types.h>
#include <unistd.h>
off_t lseek (fildes, offset, whence)
int fildes;
off_t offset;
int whence;
PARAMETERS
fildes A valid, active file descriptor.
offset The new position of the file pointer.
whence Changes the interpretation of offset.
DESCRIPTION
If fildes is a valid, active descriptor that refers to an
object pointer having a current position attribute, the
object pointer's current position is modified according to
the offset and whence parameters as follows:
If whence is SEEK_SET, the current position is set to
offset bytes.
If whence is SEEK_CUR, the current position is set to
its current location plus offset .
If whence is SEEK_END, the current position is set to
the size of the object plus offset. The size of
character special files and block special files is
always zero. Hence, this option is equivalent to
whence being SEEK_SET for these files.
If whence is equal to any other value, the user is sent
the signal SIGSYS and errno returns EINVAL.
It is an error for the new current position attribute to be
negative.
If lseek fails, the object pointer is not changed.
ACCESS CONTROL
None.
RETURN VALUE
position Completed successfully. The object pointer's
new position is returned.
Licensed material--property of copyright holder(s) Page 1
lseek(2) DG/UX 4.30 lseek(2)
-1 An error occurred. Errno is set to indicate
the error.
EXCEPTIONS
Errno may be set to one of the following error codes:
EBADF Fildes is not a valid, active descriptor.
ESPIPE Fildes is associated with a pipe or a socket.
EINVAL with SIGSYS signal
Whence is not SEEK_SET, SEEK_CUR, or
SEEK_END.
EINVAL The resulting file pointer would be negative.
SEE ALSO
creat(2), dup(2), dup2(2), fcntl(2), open(2).
Licensed material--property of copyright holder(s) Page 2