Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ lseek(2) — sys5 — Apollo

Media Vault

Software Library

Restoration Projects

Artifacts Sought



LSEEK(2)        DOMAIN/IX Reference Manual (SYS5)        LSEEK(2)



NAME
     lseek - move read/write file pointer

USAGE
     long lseek (fildes, offset, whence)
     int fildes;
     long offset;
     int whence;

DESCRIPTION
     Fildes is a file descriptor returned from a creat, open,
     dup, or fcntl system call.  Lseek sets the file pointer
     associated with fildes in the following way:

          If whence is 0, the pointer is set at offset bytes into
                the file.

          If whence is 1, the pointer is set to its current loca-
                tion plus offset.

          If whence is 2, 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.

RETURN VALUE
     Upon successful completion, lseek returns a non-negative
     integer indicating the new file pointer location.  Other-
     wise, it returns a value of -1, and sets errno to indicate
     the error.

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

     [EBADF]        Fildes is not an open file descriptor.

     [ESPIPE]       Fildes is associated with a pipe or FIFO.

     [EINVAL and SIGSYS signal]
                    Whence is not 0, 1, or 2.

     [EINVAL]       The resulting file pointer would be negative.

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

RELATED INFORMATION
     creat(2), dup(2), fcntl(2), open(2)




Printed 5/10/85                                           LSEEK-1



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