mmap

package
v1.32.21 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package mmap is replicating the functionality of the mmap-go package, however, it optimizes usage on darwin and linux to use raw syscalls instead of the golang.org/x/sys/unix package which introduces an additional mutex.

Index

Constants

View Source
const (
	// RDONLY maps the memory read-only.
	// Attempts to write to the MMap object will result in undefined behavior.
	RDONLY = 0
	// RDWR maps the memory as read-write. Writes to the MMap object will update the
	// underlying file.
	RDWR = 1 << iota
	// COPY maps the memory as copy-on-write. Writes to the MMap object will affect
	// memory, but the underlying file will remain unchanged.
	COPY
	// If EXEC is set, the mapped memory is marked as executable.
	EXEC
)
View Source
const (
	// If the ANON flag is set, the mapped memory will not be backed by a file.
	ANON = 1 << iota
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MMap

type MMap []byte

func MapRegion

func MapRegion(f *os.File, length int, prot, flags int, offset int64) (MMap, error)

func (*MMap) Unmap

func (m *MMap) Unmap() error

Jump to

Keyboard shortcuts

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