lseek(2) System Calls Manual lseek(2) lseek - / (libc -lc) #include off_t lseek(int fd, off_t offset, int whence); lseek() fd offset whence : SEEK_SET offset . SEEK_CUR offset . SEEK_END offset . lseek() ( ). ("") ('\0') . 3.1 whence: SEEK_DATA offset . offset offset. SEEK_HOLE offset. offset offset. offset ( ). lseek() offset . . . () . . ( .) SEEK_HOLE SEEK_DATA offset ( offset ). _GNU_SOURCE SEEK_DATA SEEK_HOLE . SEEK_HOLE SEEK_DATA : o Btrfs ( 3.1) o OCFS ( 3.2) o XFS ( 3.5) o ext4 ( 3.8) o tmpfs(5) ( 3.8) o NFS ( 3.18) o FUSE ( 4.5) o GFS2 ( 4.15) lseek() . (off_t) -1 errno . EBADF fd . EINVAL whence . : . ENXIO whence SEEK_DATA SEEK_HOLE offset whence SEEK_DATA offset . EOVERFLOW off_t. ESPIPE fd FIFO. lseek() ESPIPE. POSIX.1-2024. 4.3BSD SVr4 POSIX.1-1988. SEEK_DATA SEEK_HOLE Solaris 10, FreeBSD 7.0, DragonFly BSD 2.3.1, POSIX.1-2024. open(2) . O_APPEND write(2) lseek(). POSIX lseek(). dup(2), fallocate(2), fork(2), open(2), fseek(3), lseek64(3), posix_fallocate(3) 3 . . : . 6.18 11 2026 lseek(2)