From 6e5164fe441e906c67e5ac729750a713f43ae4ad Mon Sep 17 00:00:00 2001 From: Goutham Veeramachaneni Date: Wed, 14 Mar 2018 18:59:20 +0530 Subject: [PATCH] Add architecture specific map sizes Signed-off-by: Goutham Veeramachaneni --- fileutil/mmap_386.go | 5 +++++ fileutil/mmap_amd64.go | 5 +++++ fileutil/mmap_windows.go | 2 -- 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 fileutil/mmap_386.go create mode 100644 fileutil/mmap_amd64.go diff --git a/fileutil/mmap_386.go b/fileutil/mmap_386.go new file mode 100644 index 000000000..156f81b63 --- /dev/null +++ b/fileutil/mmap_386.go @@ -0,0 +1,5 @@ +// +build windows + +package fileutil + +const maxMapSize = 0x7FFFFFFF // 2GB diff --git a/fileutil/mmap_amd64.go b/fileutil/mmap_amd64.go new file mode 100644 index 000000000..4025dbfcb --- /dev/null +++ b/fileutil/mmap_amd64.go @@ -0,0 +1,5 @@ +// +build windows + +package fileutil + +const maxMapSize = 0xFFFFFFFFFFFF // 256TB diff --git a/fileutil/mmap_windows.go b/fileutil/mmap_windows.go index d1384be2b..b94226412 100644 --- a/fileutil/mmap_windows.go +++ b/fileutil/mmap_windows.go @@ -19,8 +19,6 @@ import ( "unsafe" ) -const maxMapSize = 0xFFFFFFFFFFFF // 256TB - func mmap(f *os.File, size int) ([]byte, error) { low, high := uint32(size), uint32(size>>32) h, errno := syscall.CreateFileMapping(syscall.Handle(f.Fd()), nil, syscall.PAGE_READONLY, high, low, nil)