diff options
Diffstat (limited to 'man3/lseek64.3')
-rw-r--r-- | man3/lseek64.3 | 68 |
1 files changed, 53 insertions, 15 deletions
diff --git a/man3/lseek64.3 b/man3/lseek64.3 index 043a3f7f9..47f425b55 100644 --- a/man3/lseek64.3 +++ b/man3/lseek64.3 @@ -1,4 +1,5 @@ .\" Copyright 2004 Andries Brouwer <aeb@cwi.nl>. +.\" and Copyright (c) 2020 Michael Kerrisk <mtk.manpages@gmail.com> .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this @@ -35,7 +36,7 @@ lseek64 \- reposition 64-bit read/write file offset .BI "off64_t lseek64(int " fd ", off64_t " offset ", int " whence ); .SH DESCRIPTION The -.BR lseek (2) +.BR lseek () family of functions reposition the offset of the open file associated with the file descriptor .I fd @@ -55,11 +56,15 @@ For more details, return value, and errors, see .BR lseek (2). .PP Four interfaces are available: -.BR lseek (2), +.BR lseek (), .BR lseek64 (), -.BR llseek (2), +.BR llseek (), and -.BR _llseek (2). +.BR _llseek (). +.\" +.\" For some background details, see: +.\" https://lore.kernel.org/linux-man/CAKgNAkhNSWR3uYhYYaxx74fZfJ3JrpfAAPVrK0AFk_cAOUsbDg@mail.gmail.com/ +.\" .SS lseek() Prototype: .PP @@ -69,8 +74,9 @@ Prototype: .EE .in .PP -.BR lseek (2) -uses the type +The C library's +.BR lseek () +wrapper function uses the type .IR off_t . This is a 32-bit signed type on 32-bit architectures, unless one compiles with @@ -91,9 +97,9 @@ Prototype: .EE .in .PP -The library routine +The .BR lseek64 () -uses a 64-bit type even when +library function uses a 64-bit type even when .I off_t is a 32-bit type. Its prototype (and the type @@ -109,8 +115,8 @@ is available only when one compiles with The function .BR lseek64 () .\" in glibc 2.0.94, not in 2.0.6 -is available since glibc 2.1, and is defined to be an alias for -.BR llseek (). +is available since glibc 2.1. +.\" .SS llseek() Prototype: .PP @@ -123,10 +129,9 @@ Prototype: The type .I loff_t is a 64-bit signed type. -The library routine +The .BR llseek () -.\" in libc 5.0.9, not in 4.7.6 -is available in glibc and works without special defines. +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. @@ -140,13 +145,15 @@ glibc 2.1.3 added the link-time warning .PP This makes this function unusable if one desires a warning-free compilation. +.PP Since glibc 2.28, .\" glibc commit 5c5c0dd747070db624c8e2c43691cec854f114ef this function symbol is no longer available to newly linked applications. .\" .SS _llseek() On 32-bit architectures, -this is the system call that is used to implement all of the above functions. +this is the system call that is used (by the C library wrapper functions) +to implement all of the above functions. The prototype is: .PP .in +4n @@ -165,6 +172,18 @@ system call. Instead, they have an .BR lseek (2) system call that supports 64-bit file offsets. +.\" In arch/x86/entry/syscalls/syscall_32.tbl, +.\" we see the following line: +.\" +.\" 140 i386 _llseek sys_llseek +.\" +.\" This is essentially telling us that 'sys_llseek' (the name generated +.\" by SYSCALL_DEFINE5(llseek...)) is exposed to user-space as system call +.\" number 140, and that system call number will (IIUC) be exposed in +.\" autogenerated headers with the name "__NR__llseek" (i.e., "_llseek"). +.\" The "i386" is telling us that this happens in i386 (32-bit Intel). +.\" There is nothing equivalent on x86-64, because 64 bit systems don't +.\" need an _llseek system call. .SH ATTRIBUTES For an explanation of the terms used in this section, see .BR attributes (7). @@ -177,11 +196,30 @@ T{ .BR lseek64 () T} Thread safety MT-Safe .TE +.SH NOTES +.BR 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-bit +.IR off_t +type. +As noted above, this symbol is exposed by header files if the +.B _LARGEFILE64_SOURCE +feature test macro is defined. +ALternatively, on a 32-bit system, the symbol +.I lseek +is aliased to +.I lseek64 +if the macro +.B _FILE_OFFSET_BITS +is defined with the value 64. .SH SEE ALSO .BR llseek (2), .BR lseek (2) .SH COLOPHON -This page is part of release 5.09 of the Linux +This page is part of release 5.10 of the Linux .I man-pages project. A description of the project, |