#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
> # ./seek
> lseek: Value too large for defined data type
>
> The system runs 2.4.17 kernel.
This is correct behaviour
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/