1LSEEK64(3) Linux Programmer's Manual LSEEK64(3)
2
3
4
6 lseek64 - reposition 64-bit read/write file offset
7
9 #define _LARGEFILE64_SOURCE
10 #include <sys/types.h>
11 #include <unistd.h>
12
13 off64_t lseek64(int fd, off64_t offset, int whence);
14
16 The lseek(2) 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(2), lseek64(), llseek(2), and the
24 raw system call _llseek(2).
25
26 lseek
27 Prototype:
28
29 off_t lseek(int fd, off_t offset, int whence);
30
31 lseek(2) uses the type off_t. This is a 32-bit signed type on 32-bit
32 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 library routine lseek64() 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, and is defined to
50 be an alias for llseek().
51
52 llseek
53 Prototype:
54
55 loff_t llseek(int fd, loff_t offset, int whence);
56
57 The type loff_t is a 64-bit signed type. The library routine llseek()
58 is available in libc5 and glibc and works without special defines. Its
59 prototype was given in <unistd.h> with libc5, but glibc does not pro‐
60 vide a prototype. This is bad, since a prototype is needed. Users
61 should add the above prototype, or something equivalent, to their own
62 source. When users complained about data loss caused by a miscompila‐
63 tion of e2fsck(8), glibc 2.1.3 added the link-time warning
64
65 "the `llseek´ function may be dangerous; use `lseek64´ instead."
66
67 This makes this function unusable if one desires a warning-free compi‐
68 lation.
69
70 _llseek
71 All the above functions are implemented in terms of this system call.
72 The prototype is:
73
74 int _llseek(int fd, off_t offset_hi, off_t offset_lo,
75 loff_t *result, int whence);
76
77 For more details, see llseek(2).
78
80 llseek(2), lseek(2), feature_test_macros(7)
81
83 This page is part of release 3.22 of the Linux man-pages project. A
84 description of the project, and information about reporting bugs, can
85 be found at http://www.kernel.org/doc/man-pages/.
86
87
88
89Linux 2004-12-11 LSEEK64(3)