#include <sys/types.h> #include <unistd.h>
offset_t llseek(int fildes, offset_t offset, int whence);
llseek() sets the 64-bit extended file pointer associated with the open file descriptor specified by fildes as follows:
- If whence is SEEK_SET, the pointer is set to offset bytes.
- If whence is SEEK_CUR, the pointer is set to its current location plus offset.
- If whence is SEEK_END, the pointer is set to the size of the file plus offset.
On success, llseek() returns the resulting pointer location, as measured in bytes from the beginning of the file.
Upon successful completion, the resulting file pointer is returned. Remote file descriptors are the only ones that allow negative file pointers. Otherwise, a value of -1 is returned and errno is set to indicate the error.
llseek() fails and the file pointer remains unchanged if one or more of the following are true:
Some devices are incapable of seeking. The value of the file pointer associated with such a device is undefined.