off_t seek(int fd, off_t offset, int whence);
This syscall repositions the file offset of the passed file description to the passed offset according to the directive whence as follows:
SEEK_SET
(1): Set to the passed offset.
SEEK_CUR
(2): Set to the current offset plus the passed offset.
SEEK_END
(4): Set to the size of the file plus the passed offset.
This syscall returns the resulting offset, or -1
on failure. errno is to
be set to:
EBADF
: Bad file descriptor.
EINVAL
: The whence is malformed or the resulting offset would be invalid.
ESPIPE
: seek
was called on a TTY or a pipe.