2019-09-03 16:00:59 +00:00
|
|
|
// +build !windows
|
|
|
|
|
|
|
|
package memory_map
|
|
|
|
|
2019-09-04 13:24:17 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
)
|
2019-09-03 16:00:59 +00:00
|
|
|
|
|
|
|
type MemoryBuffer struct {
|
|
|
|
aligned_length uint64
|
|
|
|
length uint64
|
|
|
|
aligned_ptr uintptr
|
|
|
|
ptr uintptr
|
|
|
|
Buffer []byte
|
|
|
|
}
|
|
|
|
|
|
|
|
type MemoryMap struct {
|
|
|
|
File *os.File
|
|
|
|
file_memory_map_handle uintptr
|
|
|
|
write_map_views []MemoryBuffer
|
|
|
|
max_length uint64
|
2019-09-04 13:24:17 +00:00
|
|
|
End_of_file int64
|
2019-09-03 16:00:59 +00:00
|
|
|
}
|
|
|
|
|
2019-09-04 13:24:17 +00:00
|
|
|
var FileMemoryMap = make(map[string]*MemoryMap)
|
|
|
|
|
|
|
|
func (mMap *MemoryMap) WriteMemory(offset uint64, length uint64, data []byte) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mMap *MemoryMap) ReadMemory(offset uint64, length uint64) (MemoryBuffer, error) {
|
|
|
|
return MemoryBuffer{}, fmt.Errorf("Memory Map not implemented for this platform")
|
|
|
|
}
|
|
|
|
|
2019-09-05 12:46:29 +00:00
|
|
|
func (mBuffer *MemoryBuffer) ReleaseMemory() {
|
2019-09-04 13:24:17 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-09-05 12:46:29 +00:00
|
|
|
func (mBuffer *MemoryMap) DeleteFileAndMemoryMap() {
|
2019-09-04 13:24:17 +00:00
|
|
|
|
|
|
|
}
|