* lseek SEEK_END fails on a Toshiba 6007MB disk.
@ 2002-02-20 23:40 Kallol Biswas
2002-02-21 0:01 ` Alan Cox
2002-02-21 0:23 ` Andreas Dilger
0 siblings, 2 replies; 3+ messages in thread
From: Kallol Biswas @ 2002-02-20 23:40 UTC (permalink / raw)
To: linux-kernel
#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <unistd.h>
main(int argc, char *argv[])
{
int fd;
int offset;
int loffset;
fd = open("/dev/hda", O_RDONLY);
if (fd < 0) {
perror("open");
return;
}
offset = lseek(fd, 0, SEEK_END);
if (offset < 0) {
perror("lseek");
}
}
# ./seek
lseek: Value too large for defined data type
The system runs 2.4.17 kernel.
A fix may be found reading the source code, but if someone already knows
the solution, please reply to me.
Kallol
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: lseek SEEK_END fails on a Toshiba 6007MB disk. 2002-02-20 23:40 lseek SEEK_END fails on a Toshiba 6007MB disk Kallol Biswas @ 2002-02-21 0:01 ` Alan Cox 2002-02-21 0:23 ` Andreas Dilger 1 sibling, 0 replies; 3+ messages in thread From: Alan Cox @ 2002-02-21 0:01 UTC (permalink / raw) To: Kallol Biswas; +Cc: linux-kernel > # ./seek > lseek: Value too large for defined data type > > The system runs 2.4.17 kernel. This is correct behaviour ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: lseek SEEK_END fails on a Toshiba 6007MB disk. 2002-02-20 23:40 lseek SEEK_END fails on a Toshiba 6007MB disk Kallol Biswas 2002-02-21 0:01 ` Alan Cox @ 2002-02-21 0:23 ` Andreas Dilger 1 sibling, 0 replies; 3+ messages in thread From: Andreas Dilger @ 2002-02-21 0:23 UTC (permalink / raw) To: Kallol Biswas; +Cc: linux-kernel On Feb 20, 2002 15:40 -0800, Kallol Biswas wrote: > offset = lseek(fd, 0, SEEK_END); > > lseek: Value too large for defined data type You need to use a 64-bit lseek (e.g. llseek or lseek64). This can be done with '#define _LARGEFILE_SOURCE' and/or '#define _LARGEFILE64_SOURCE' and/or '#define _FILE_OFFSET_BITS=64'. Cheers, Andreas -- Andreas Dilger http://sourceforge.net/projects/ext2resize/ http://www-mddsp.enel.ucalgary.ca/People/adilger/ ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-02-21 0:23 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2002-02-20 23:40 lseek SEEK_END fails on a Toshiba 6007MB disk Kallol Biswas 2002-02-21 0:01 ` Alan Cox 2002-02-21 0:23 ` Andreas Dilger
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.