Re: lseek: Value too large for defined data type



On Fri, 20 Jul 2007 11:42:46 +0100 Tim Southerwood <ts@xxxxxxxxxx> wrote:
| guru wrote:
|
|> Hi All,
|>
|> I have written 21GB file and updating the file by seeking 1K and
|> writing 100MB of data consecutively 10240 times. when after writing
|> 2GB(2100 times) of file it was giving
|>
|> lseek: Value too large for defined data type error.
|>
|> What is got is the value passed to 'Offset' argument is too large to
|> handle.
|>
|> The last return value of seek is '2099270656'
|>
|> Is there any way to overcome this.
|>
|>
|> Thanks & Regads
|> Gururaja
|
| Yes - it is a standard problem, with a standard set of solutions.
|
| off_t is normally defined as a 32 bit signed.
|
| Try man lseek64
|
| In summary from that page, you can either explicitly use lseek64() and
| off64_t (not portable where lseek64 is not defined but you don't need >2GB
| support)
|
| or leave everything as "off_t" and "lseek()" but do a
|
| #define _FILE_OFFSET_BITS 64
|
| higher up in the source (or via the Makefile or whatever)
|
| and that will cast lseek to lseek64 and off_t to off64_t on systems that
| suppport it.

One of these days we need to fix all this ... basically migrate to purely
64-bit file offset platforms. It should "just work" without any changes
needed at that point, if they do it right (which is not a given). If old
programs compiled on legacy 32-bit file offset platforms break, so be it.

--
|---------------------------------------/----------------------------------|
| Phil Howard KA9WGN (ka9wgn.ham.org) / Do not send to the address below |
| first name lower case at ipal.net / spamtrap-2007-07-20-2147@xxxxxxxx |
|------------------------------------/-------------------------------------|
.