Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ lseek2(3) — Solstice DiskSuite 1.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

lseek(2V)

quadops(3)

LSEEK2(3)  —  C LIBRARY FUNCTIONS

NAME

lseek2 − move extended read/write pointer

SYNOPSIS

#include <sys/types.h>
#include <unistd.h>

quad_t lseek2(fd, offset, whence)
int fd;
quad_t offset;
int whence;

DESCRIPTION

lseek2() sets the seek pointer associated with the open file or device referred to by the descriptor fd according to the value supplied for whence. It is similar to the lseek(2V) system call.  However, offset is a 64-bit signed integer represented by a structure of type quad_t.  See quadops(3) for information on manipulating quad_t’s.  Use of offsets of more than 32 bits requires extensions to the SunOS kernel.  The Sun Online: DiskSuite unbundled product allows these offsets to be used under restricted conditions; see RESTRICTIONS below.  Future SunOS releases may allow more general use of 64-bit offsets. 

Just as with lseek(), whence must be one of the following constants defined in <unistd.h>:

SEEK_SET
SEEK_CUR
SEEK_END

If whence is SEEK_SET, the seek pointer is set to offset bytes.  If whence is SEEK_CUR, the seek pointer is set to its current location plus offset. If whence is SEEK_END, the seek pointer is set to the size of the file plus offset.

RETURN VALUES

If the seek is successful, lseek2() returns the updated value of the 64-bit seek pointer; on failure it returns the quad_t representation of −1 and sets errno to indicate the error. 

RESTRICTIONS

The Sun Online: DiskSuite unbundled product places restrictions on the use of offsets too large to express as a 32-bit signed integer, i.e., those greater than 231 -1 or less than -231.  Such offsets may be used only with character special devices.  If offset is too large to represent in 32 bits, it must be a multiple of 512.  Whenever a call to lseek2() results in the seek pointer exceeding the range of 32-bit values, it must also be a multiple of 512.  Both offset and the seek pointer must remain less than 1 terabyte (240) in magnitude.  Failure to satisfy any of these conditions results in an EINVAL error. 

Mixing lseek2() and lseek() operations on the same open file will have unpredictable results. 

ERRORS

lseek2() will fail and the seek pointer will remain unchanged if:

EBADF fd is not an open file descriptor. 

EINVAL whence is not a proper value. 

The seek operation would result in an illegal file offset value for the file (for example, a negative file offset for a file other than a character special file). 

offset is outside the range -231.  through 231 -1 and is not a multiple of 512. 

offset exceeds 1 terabyte in magnitude. 

ESPIPE fd is associated with a pipe or a socket. 

EFBIG The seek operation would result in a seek pointer that is too large to represent with a 32-bit signed integer and that is not a multiple of 512. 

SEE ALSO

lseek(2V), quadops(3)

Sun Online: DiskSuite Administration Guide

Sun Release 4.1  —  Last change: 1 July 1991

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