next up previous contents
Next: mlock: lock a region Up: MOSS system calls Previous: kill: send a signal

lseek: reposition current offset in a file

SYNOPSIS

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

DESCRIPTION

This system call implements the POSIX lseek function, which changes the current file offset in a file descriptor.

PARAMETERS

fd
The file desriptor to reposition.
offset
The file offset to seek to relative to the base specified by whence.
whence
The base from which offset is relative:
  • SEEK_SET: Seek relative to the beginning of the file.
  • SEEK_CUR: Seek relative to the current position.
  • SEEK_END: Seek relative to the end of the file.

RETURN VALUE

Returns the new absolute file position if successful, or -1 on error, in which case errno indicates the error.



Bryan Ford