Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ lseek(2) — sys5 — Apollo Domain/OS SR10.4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

creat(2)

dup(2)

fcntl(2)

open(2)

LSEEK(2)                             SysV                             LSEEK(2)



NAME
     lseek - move read/write file pointer

SYNOPSIS
     #include <sys/types.h>

     #include <unistd.h>

     off_t lseek (fildes, offset, whence)
     int fildes;
     off_t offset;
     int whence;

DESCRIPTION
     fildes is a file descriptor returned from a creat(2), open(2), dup(2), or
     fcntl(2) system call.  lseek sets the file pointer associated with fildes
     as follows:

     +  If whence is SEEK_SET, the pointer is set to offset bytes.

     +  If whence is SEEK_CUR, the pointer is set to its current location plus
        offset.

     +  If whence is SEEK_END, the pointer is set to the size of the file plus
        offset.

     Upon successful completion, the resulting pointer location, as measured
     in bytes from the beginning of the file, is returned.  Note that if
     fildes is a remote file descriptor and offset is negative, lseek will
     return the file pointer even if it is negative.

DIAGNOSTICS
     Upon successful completion, a non-negative integer indicating the file
     pointer value is returned.  If the lseek function fails, the file offset
     remains unchanged, a value of (off_t) - 1 is returned, and errno is set
     to indicate the error.

ERRORS
     lseek will fail and the file pointer will remain unchanged if one or more
     of the following are true:

     [EBADF]    fildes is not an open file descriptor.

     [ESPIPE]   fildes is associated with a pipe or fifo.

     [EINVAL]   whence is not SEEK_SET, SEEK_CUR, or SEEK_END; or the
                resulting file offset be invalid.

     Some devices are incapable of seeking.  The value of the file pointer
     associated with such a device is undefined.

SEE ALSO
     creat(2), dup(2), fcntl(2), open(2) <sys/types.h>, <unistd.h>.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026