NAME | SYNOPSIS | API RESTRICTIONS | FEATURES | DESCRIPTION | RETURN VALUE | ATTRIBUTES | SEE ALSO
#include <unistd.h>off_t lseek(int fildes, off_t offset, int whence);
The function or functions documented here may not be used safely in all application contexts with all APIs provided in the ChorusOS 5.0 product.
See API(5FEA) for details.
MSDOSFS, NFS_CLIENT, UFS
The fildes field contains a file descriptor returned from an open(2POSIX), or dup(2POSIX) system call. The lseek() function sets the file pointer associated with fildes as follows:
whence is SEEK_SET (0), the pointer is set to offset bytes.
whence is SEEK_CUR (1), the pointer is set to its current location plus offset.
whence is SEEK_END (2), the pointer is set to the size of the file plus offset.
The lseek() primitive allows the file offset to be set beyond the existing end-of-file. If data is later written at this point, subsequent reads of data in the gap return bytes of zero until data is actually written into the gap.
Upon successful completion, lseek() returns the resulting pointer location, as measured in bytes from the beginning of the file; otherwise it returns -1 and sets errno to indicate one of the following error conditions:
fildes is not an open file descriptor.
whence is not SEEK_SET, SEEK_CUR or SEEK_END.
The resulting file pointer would be negative.
Some devices are incapable of seeking. The value of the file pointer associated with this type of device is undefined.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
MT-Level | Async-Signal-Safe |
NAME | SYNOPSIS | API RESTRICTIONS | FEATURES | DESCRIPTION | RETURN VALUE | ATTRIBUTES | SEE ALSO