mmap

Hello. I'm writing some random access i/o software on Solaris 8 using mmap64 to memory map large files (my test file is ~25 GB).

The abbreviated code fragment is:

fd = open(cbuf,O_RDONLY|O_LARGEFILE);

struct stat statbuf;
fstat(fd,&statbuf);

off_t len = (off_t)statbuf.st_size; // len = 24974764635

map_ptr = (char *)mmap64(NULL,len,
PROT_READ,
MAP_NORESERVE|MAP_SHARED,
fd,0);

madvise(map_ptr,len,MADV_DONTNEED | MADV_RANDOM);

I think the problem may be mmap's 2nd argument which is (size_t) intead of (off_t) because I only have access up to 3.5 GB, which is about the value of the bottom 32 bytes of len.

Any help you can provide will be greatly appreciated.

Thanks,
gusm