NAME |LIBRARY |SYNOPSIS |DESCRIPTION |ATTRIBUTES |NOTES |SEE ALSO |COLOPHON | |
lseek64(3) Library Functions Manuallseek64(3)lseek64 - reposition 64-bit read/write file offset
Standard C library (libc,-lc)
#define _LARGEFILE64_SOURCE/* See feature_test_macros(7) */#include <sys/types.h>#include <unistd.h>off64_t lseek64(intfd, off64_toffset, intwhence);
Thelseek() family of functions reposition the offset of the open file associated with the file descriptorfd tooffset bytes relative to the start, current position, or end of the file, whenwhence has the valueSEEK_SET,SEEK_CUR, orSEEK_END, respectively. For more details, return value, and errors, seelseek(2). Four interfaces are available:lseek(),lseek64(),llseek(), and_llseek().lseek() Prototype:off_t lseek(intfd, off_toffset, intwhence); The C library'slseek() wrapper function uses the typeoff_t. This is a 32-bit signed type on 32-bit architectures, unless one compiles with #define _FILE_OFFSET_BITS 64 in which case it is a 64-bit signed type.lseek64() Prototype:off64_t lseek64(intfd, off64_toffset, intwhence); Thelseek64() library function uses a 64-bit type even whenoff_t is a 32-bit type. Its prototype (and the typeoff64_t) is available only when one compiles with #define _LARGEFILE64_SOURCE The functionlseek64() is available since glibc 2.1.llseek() Prototype:loff_t llseek(intfd, loff_toffset, intwhence); The typeloff_t is a 64-bit signed type. Thellseek() library function is available in glibc and works without special defines. However, the glibc headers do not provide a prototype. Users should add the above prototype, or something equivalent, to their own source. When users complained about data loss caused by a miscompilation ofe2fsck(8), glibc 2.1.3 added the link-time warning "the `llseek´ function may be dangerous; use `lseek64´ instead." This makes this function unusable if one desires a warning-free compilation. Since glibc 2.28, this function symbol is no longer available to newly linked applications._llseek() On 32-bit architectures, this is the system call that is used (by the C library wrapper functions) to implement all of the above functions. The prototype is:int _llseek(intfd, off_toffset_hi, off_toffset_lo,loff_t *result, intwhence); For more details, seellseek(2). 64-bit systems don't need an_llseek() system call. Instead, they have anlseek(2) system call that supports 64-bit file offsets.
For an explanation of the terms used in this section, seeattributes(7). ┌──────────────────────────────────────┬───────────────┬─────────┐ │Interface│Attribute│Value│ ├──────────────────────────────────────┼───────────────┼─────────┤ │lseek64() │ Thread safety │ MT-Safe │ └──────────────────────────────────────┴───────────────┴─────────┘
lseek64() is one of the functions that was specified in the Large File Summit (LFS) specification that was completed in 1996. The purpose of the specification was to provide transitional support that allowed applications on 32-bit systems to access files whose size exceeds that which can be represented with a 32-bitoff_t type. As noted above, this symbol is exposed by header files if the_LARGEFILE64_SOURCEfeature test macro is defined. ALternatively, on a 32-bit system, the symbollseek is aliased tolseek64 if the macro_FILE_OFFSET_BITSis defined with the value 64.
llseek(2),lseek(2)
This page is part of theman-pages (Linux kernel and C library user-space interface documentation) project. Information about the project can be found at ⟨https://www.kernel.org/doc/man-pages/⟩. If you have a bug report for this manual page, see ⟨https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING⟩. This page was obtained from the tarball man-pages-6.15.tar.gz fetched from ⟨https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/⟩ on 2025-08-11. If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up- to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which isnot part of the original manual page), send a mail to man-pages@man7.orgLinux man-pages 6.15 2025-05-17lseek64(3)Pages that refer to this page:llseek(2), lseek(2), off_t(3type)
HTML rendering created 2025-09-06 byMichael Kerrisk, author ofThe Linux Programming Interface. For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere. Hosting byjambit GmbH. | ![]() |