Reputation: 1918
The syscall.Mmap() call takes a length argument of type int, which is only good for 2GB. How do I mmap a bigger file then?
Note: 64-bit system, so address space is not a problem.
Upvotes: 0
Views: 1941
Reputation: 857
Look in http://golang.org/src/pkg/syscall/syscall_unix.go at the Mmap method on mmapper. You should be able to copy that code and adapt it as required.
Of course you won't be able to mmap to a []byte, since slice lengths are defined to be "int" (which is 32-bit everywhere at the moment). You could mmap to a larger element type (e.g. []int32), or just muck with the pointer to the memory, but it won't be a drop-in replacement to syscall.Mmap.
Upvotes: 4