Reputation: 1039
I've noticed that when I try to seek more bytes than off_t can represent I get an EOVERFLOW error. How can I seek more than the bigger number in off_t?
Upvotes: 1
Views: 1363
Reputation: 16406
See http://www.kernel.org/doc/man-pages/online/pages/man3/lseek64.3.html
Upvotes: 0
Reputation: 798566
Enable large file support.
In a nutshell for using LFS you can choose either of the following:
- Compile your programs with "
gcc -D_FILE_OFFSET_BITS=64
". This forces all file access calls to use the 64 bit variants. Several types change also, e.g.off_t
becomesoff64_t
. It's therefore important to always use the correct types and to not use e.g.int
instead ofoff_t
. For portability with other platforms you should usegetconf LFS_CFLAGS
which will return-D_FILE_OFFSET_BITS=64
on Linux platforms but might return something else on e.g. Solaris. For linking, you should use the link flags that are reported viagetconf LFS_LDFLAGS
. On Linux systems, you do not need special link flags.- Define
_LARGEFILE_SOURCE
and_LARGEFILE64_SOURCE
. With these defines you can use the LFS functions like open64 directly.- Use the
O_LARGEFILE
flag withopen
to operate on large files.
Upvotes: 6