mmap

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2022 License: 0BSD Imports: 8 Imported by: 0

README

This is a simple wrapper over github.com/edsrzf/mmap-go which takes
care of opening and closing files and makes it easy to handle SIGBUS.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressError

type AddressError interface {
	runtime.Error
	Addr() uintptr
}

This is what the go runtime produces on SIGBUS and SIGSEGV. Unfortunately the type is not exported from the runtime.

type MMap

type MMap mmap.MMap

func Map

func Map(fname string) (MMap, error)

Map this file into memory

func (*MMap) Unmap

func (m *MMap) Unmap()

Unmaps this mapping

func (MMap) With

func (m MMap) With(f func(data []byte)) (out error)

Call the provided function with the map data and convert any fault into a OffsetError.

type OffsetError

type OffsetError struct {
	Offset uintptr
	Err    error
}

The function With produces this when a fault happens inside the provided mapping.

func (*OffsetError) Error

func (e *OffsetError) Error() string

func (*OffsetError) Unwrap

func (e *OffsetError) Unwrap() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL