]>
Commit | Line | Data |
---|---|---|
1043e25b MK |
1 | .\" Copyright 2004 Andries Brouwer <aeb@cwi.nl>. |
2 | .\" | |
93015253 | 3 | .\" %%%LICENSE_START(VERBATIM) |
1043e25b MK |
4 | .\" Permission is granted to make and distribute verbatim copies of this |
5 | .\" manual provided the copyright notice and this permission notice are | |
6 | .\" preserved on all copies. | |
7 | .\" | |
8 | .\" Permission is granted to copy and distribute modified versions of this | |
9 | .\" manual under the conditions for verbatim copying, provided that the | |
10 | .\" entire resulting derived work is distributed under the terms of a | |
11 | .\" permission notice identical to this one. | |
12 | .\" | |
13 | .\" Since the Linux kernel and libraries are constantly changing, this | |
14 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
15 | .\" responsibility for errors or omissions, or for damages resulting from | |
16 | .\" the use of the information contained herein. The author(s) may not | |
17 | .\" have taken the same level of care in the production of this manual, | |
18 | .\" which is licensed free of charge, as they might when working | |
19 | .\" professionally. | |
20 | .\" | |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by | |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 23 | .\" %%%LICENSE_END |
1043e25b | 24 | .\" |
4b8c67d9 | 25 | .TH LSEEK64 3 2017-09-15 "Linux" "Linux Programmer's Manual" |
1043e25b MK |
26 | .SH NAME |
27 | lseek64 \- reposition 64-bit read/write file offset | |
28 | .SH SYNOPSIS | |
b80f966b | 29 | .BR "#define _LARGEFILE64_SOURCE" " /* See feature_test_macros(7) */" |
1043e25b MK |
30 | .br |
31 | .B #include <sys/types.h> | |
32 | .br | |
33 | .B #include <unistd.h> | |
68e4db0a | 34 | .PP |
1043e25b MK |
35 | .BI "off64_t lseek64(int " fd ", off64_t " offset ", int " whence ); |
36 | .SH DESCRIPTION | |
37 | The | |
38 | .BR lseek (2) | |
3ba7aed4 MK |
39 | family of functions reposition the offset of the open file associated |
40 | with the file descriptor | |
1043e25b MK |
41 | .I fd |
42 | to | |
43 | .I offset | |
3ba7aed4 | 44 | bytes relative to the start, current position, or end of the file, |
1043e25b MK |
45 | when |
46 | .I whence | |
47 | has the value | |
48 | .BR SEEK_SET , | |
49 | .BR SEEK_CUR , | |
50 | or | |
51 | .BR SEEK_END , | |
52 | respectively. | |
dd3568a1 | 53 | .PP |
1043e25b MK |
54 | For more details, return value, and errors, see |
55 | .BR lseek (2). | |
56 | .PP | |
57 | Four interfaces are available: | |
3a72373c | 58 | .BR lseek (2), |
31e9a9ec | 59 | .BR lseek64 (), |
3a72373c | 60 | .BR llseek (2), |
b981bf29 | 61 | and |
3a72373c | 62 | .BR _llseek (2). |
2d5b086a | 63 | .SS lseek() |
1043e25b | 64 | Prototype: |
bdd915e2 | 65 | .PP |
088a639b | 66 | .in +4n |
bdd915e2 | 67 | .EX |
1043e25b | 68 | .BI "off_t lseek(int " fd ", off_t " offset ", int " whence ); |
bdd915e2 | 69 | .EE |
088a639b | 70 | .in |
bdd915e2 | 71 | .PP |
09aa2068 | 72 | .BR lseek (2) |
1043e25b | 73 | uses the type |
31e9a9ec | 74 | .IR off_t . |
3ba7aed4 | 75 | This is a 32-bit signed type on 32-bit architectures, unless one |
1043e25b | 76 | compiles with |
bdd915e2 | 77 | .PP |
088a639b | 78 | .in +4n |
bdd915e2 | 79 | .EX |
1043e25b | 80 | #define _FILE_OFFSET_BITS 64 |
bdd915e2 | 81 | .EE |
088a639b | 82 | .in |
bdd915e2 | 83 | .PP |
1043e25b | 84 | in which case it is a 64-bit signed type. |
2d5b086a | 85 | .SS lseek64() |
1043e25b | 86 | Prototype: |
bdd915e2 | 87 | .PP |
088a639b | 88 | .in +4n |
bdd915e2 | 89 | .EX |
1043e25b | 90 | .BI "off64_t lseek64(int " fd ", off64_t " offset ", int " whence ); |
bdd915e2 | 91 | .EE |
088a639b | 92 | .in |
bdd915e2 | 93 | .PP |
1043e25b | 94 | The library routine |
31e9a9ec | 95 | .BR lseek64 () |
1043e25b | 96 | uses a 64-bit type even when |
31e9a9ec | 97 | .I off_t |
c13182ef MK |
98 | is a 32-bit type. |
99 | Its prototype (and the type | |
31e9a9ec | 100 | .IR off64_t ) |
1043e25b | 101 | is available only when one compiles with |
bdd915e2 | 102 | .PP |
088a639b | 103 | .in +4n |
bdd915e2 | 104 | .EX |
1043e25b | 105 | #define _LARGEFILE64_SOURCE |
bdd915e2 | 106 | .EE |
088a639b | 107 | .in |
bdd915e2 | 108 | .PP |
1043e25b | 109 | The function |
31e9a9ec | 110 | .BR lseek64 () |
1043e25b | 111 | .\" in glibc 2.0.94, not in 2.0.6 |
3ba7aed4 | 112 | is available since glibc 2.1, and is defined to be an alias for |
31e9a9ec | 113 | .BR llseek (). |
2d5b086a | 114 | .SS llseek() |
1043e25b | 115 | Prototype: |
bdd915e2 | 116 | .PP |
088a639b | 117 | .in +4n |
bdd915e2 | 118 | .EX |
1043e25b | 119 | .BI "loff_t llseek(int " fd ", loff_t " offset ", int " whence ); |
bdd915e2 | 120 | .EE |
088a639b | 121 | .in |
bdd915e2 | 122 | .PP |
1043e25b | 123 | The type |
31e9a9ec | 124 | .I loff_t |
1043e25b MK |
125 | is a 64-bit signed type. |
126 | The library routine | |
31e9a9ec | 127 | .BR llseek () |
1043e25b | 128 | .\" in libc 5.0.9, not in 4.7.6 |
7824ab23 | 129 | is available in glibc and works without special defines. |
4558b2b0 | 130 | However, the glibc headers do not provide a prototype. |
c13182ef | 131 | Users should add |
1043e25b MK |
132 | the above prototype, or something equivalent, to their own source. |
133 | When users complained about data loss caused by a miscompilation of | |
134 | .BR e2fsck (8), | |
135 | glibc 2.1.3 added the link-time warning | |
bdd915e2 | 136 | .PP |
088a639b | 137 | .in +4n |
3ba7aed4 | 138 | "the \`llseek\' function may be dangerous; use \`lseek64\' instead." |
088a639b | 139 | .in |
bdd915e2 | 140 | .PP |
1043e25b MK |
141 | This makes this function unusable if one desires a warning-free |
142 | compilation. | |
2d5b086a | 143 | .SS _llseek() |
b981bf29 MK |
144 | On 32-bit architectures, |
145 | this is the system call that is used to implement all of the above functions. | |
1043e25b | 146 | The prototype is: |
bdd915e2 | 147 | .PP |
088a639b | 148 | .in +4n |
bdd915e2 | 149 | .EX |
b9f02710 | 150 | .BI "int _llseek(int " fd ", off_t " offset_hi ", off_t " offset_lo , |
088a639b | 151 | .BI " loff_t *" result ", int " whence ); |
bdd915e2 | 152 | .EE |
088a639b | 153 | .in |
bdd915e2 | 154 | .PP |
1043e25b MK |
155 | For more details, see |
156 | .BR llseek (2). | |
847e0d88 | 157 | .PP |
b981bf29 MK |
158 | 64-bit systems don't need an |
159 | .BR _llseek () | |
160 | system call. | |
161 | Instead, they have an | |
162 | .BR lseek (2) | |
163 | system call that supports 64-bit file offsets. | |
0105e371 | 164 | .SH ATTRIBUTES |
3c8f7847 PH |
165 | For an explanation of the terms used in this section, see |
166 | .BR attributes (7). | |
167 | .TS | |
168 | allbox; | |
169 | lb lb lb | |
170 | l l l. | |
171 | Interface Attribute Value | |
172 | T{ | |
0105e371 | 173 | .BR lseek64 () |
3c8f7847 PH |
174 | T} Thread safety MT-Safe |
175 | .TE | |
47297adb | 176 | .SH SEE ALSO |
1043e25b | 177 | .BR llseek (2), |
0a4f8b7b | 178 | .BR lseek (2) |