1LSEEK64(3)                 Linux Programmer's Manual                LSEEK64(3)
2
3
4

NAME

6       lseek64 - reposition 64-bit read/write file offset
7

SYNOPSIS

9       #define _LARGEFILE64_SOURCE     /* See feature_test_macros(7) */
10       #include <sys/types.h>
11       #include <unistd.h>
12
13       off64_t lseek64(int fd, off64_t offset, int whence);
14

DESCRIPTION

16       The  lseek() family of functions reposition the offset of the open file
17       associated with the file descriptor fd to offset bytes relative to  the
18       start,  current position, or end of the file, when whence has the value
19       SEEK_SET, SEEK_CUR, or SEEK_END, respectively.
20
21       For more details, return value, and errors, see lseek(2).
22
23       Four  interfaces  are  available:  lseek(),  lseek64(),  llseek(),  and
24       _llseek().
25
26   lseek()
27       Prototype:
28
29           off_t lseek(int fd, off_t offset, int whence);
30
31       The  C library's lseek() wrapper function uses the type off_t.  This is
32       a 32-bit signed type on 32-bit architectures, unless one compiles with
33
34           #define _FILE_OFFSET_BITS 64
35
36       in which case it is a 64-bit signed type.
37
38   lseek64()
39       Prototype:
40
41           off64_t lseek64(int fd, off64_t offset, int whence);
42
43       The lseek64() library function uses a 64-bit type even when off_t is  a
44       32-bit  type.   Its  prototype (and the type off64_t) is available only
45       when one compiles with
46
47           #define _LARGEFILE64_SOURCE
48
49       The function lseek64() is available since glibc 2.1.
50
51   llseek()
52       Prototype:
53
54           loff_t llseek(int fd, loff_t offset, int whence);
55
56       The type loff_t is a 64-bit signed type.  The llseek() library function
57       is  available in glibc and works without special defines.  However, the
58       glibc headers do not provide a prototype.  Users should add  the  above
59       prototype,  or  something  equivalent, to their own source.  When users
60       complained about data loss caused by  a  miscompilation  of  e2fsck(8),
61       glibc 2.1.3 added the link-time warning
62
63           "the `llseek´ function may be dangerous; use `lseek64´ instead."
64
65       This  makes this function unusable if one desires a warning-free compi‐
66       lation.
67
68       Since glibc 2.28, this function symbol is no longer available to  newly
69       linked applications.
70
71   _llseek()
72       On 32-bit architectures, this is the system call that is used (by the C
73       library wrapper functions) to implement all  of  the  above  functions.
74       The prototype is:
75
76           int _llseek(int fd, off_t offset_hi, off_t offset_lo,
77                       loff_t *result, int whence);
78
79       For more details, see llseek(2).
80
81       64-bit systems don't need an _llseek() system call.  Instead, they have
82       an lseek(2) system call that supports 64-bit file offsets.
83

ATTRIBUTES

85       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
86       tributes(7).
87
88       ┌──────────┬───────────────┬─────────┐
89Interface Attribute     Value   
90       ├──────────┼───────────────┼─────────┤
91lseek64() │ Thread safety │ MT-Safe │
92       └──────────┴───────────────┴─────────┘

NOTES

94       lseek64()  is one of the functions that was specified in the Large File
95       Summit (LFS) specification that was completed in 1996.  The purpose  of
96       the  specification was to provide transitional support that allowed ap‐
97       plications on 32-bit systems to access files whose  size  exceeds  that
98       which  can  be  represented  with a 32-bit off_t type.  As noted above,
99       this symbol is exposed by header files if the _LARGEFILE64_SOURCE  fea‐
100       ture  test  macro  is  defined.  ALternatively, on a 32-bit system, the
101       symbol lseek is aliased to lseek64 if the  macro  _FILE_OFFSET_BITS  is
102       defined with the value 64.
103

SEE ALSO

105       llseek(2), lseek(2)
106

COLOPHON

108       This  page  is  part of release 5.10 of the Linux man-pages project.  A
109       description of the project, information about reporting bugs,  and  the
110       latest     version     of     this    page,    can    be    found    at
111       https://www.kernel.org/doc/man-pages/.
112
113
114
115Linux                             2020-11-01                        LSEEK64(3)
Impressum