FD_LSEEK(3H) — Pixar Programmer’s Manual — libfd
NAME
fd_lseek− move read/write pointer on fast-disk
SYNOPSIS
#include <sys/file.h>
#define L_SET0/∗ set the seek pointer ∗/
#define L_INCR1/∗ increment the seek pointer ∗/
#define L_XTND2/∗ set the seek pointer relative to the end of file ∗/
fdoff_t fd_lseek(d, offset, whence)
int d;
long offset;
int whence;
DESCRIPTION
The descriptor d refers to a file on the Fast-Disk open for reading and/or writing. Lseek sets the file pointer of d as follows:
If whence is L_SET, the pointer is set to offset bytes.
If whence is L_INCR, the pointer is set to its current location plus offset.
If whence is L_XTND, the pointer is set to the size of the file plus offset.
Upon successful completion, the resulting pointer location as measured in bytes from beginning of the file is returned.
NOTES
Since files on the fast disk are preallocated, seeking beyond the end of the file has no use. Thus the whence value of L_XTND is not mnemonic. It is permissible to seek using L_XTND to the end or somewhere prior to the end of the file.
RETURN VALUE
Upon successful completion, the current file pointer value is returned. Otherwise, a value of −1 is returned and errno is set to indicate the error.
ERRORS
fd_lseek will fail and the file pointer will remain unchanged if:
[EBADF] Fildes is not an open fast disk file descriptor.
[EINVAL] Whence is not a proper value.
SEE ALSO
fd_create(3H), fd_open(3H), fd_read(3H), fd_write(3H)
Release β — Last change: 10/12/88