mmap

package
Version: v0.0.0-...-9649366 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Munmap

func Munmap(b []byte) error

Munmap munmaps a byte slice that is backed by an mmap

Types

type FileDesc

type FileDesc struct {
	// file is the *os.File ref to store
	File **os.File
	// bytes is the []byte slice ref to store the mmap'd address
	Bytes *[]byte
	// options specifies options to use when mmaping a file
	Options Options
}

FileDesc contains the fields required for Mmaping a file using MmapFiles

type FileOpener

type FileOpener func(filePath string) (*os.File, error)

FileOpener is the signature of a function that MmapFiles can use to open files

type FilesResult

type FilesResult struct {
	Warning error
}

FilesResult contains the result of calling MmapFiles

func Files

func Files(opener FileOpener, files map[string]FileDesc) (FilesResult, error)

Files is a utility function for mmap'ing a group of files at once

type HugeTLBOptions

type HugeTLBOptions struct {
	// enabled determines if using the huge TLB flag is enabled for platforms
	// that support it
	Enabled bool
	// threshold determines if the size being mmap'd is greater or equal
	// to this value to use or not use the huge TLB flag if enabled
	Threshold int64
}

HugeTLBOptions contains all options related to huge TLB

type Options

type Options struct {
	// read is whether to make mmap bytes ref readable
	Read bool
	// write is whether to make mmap bytes ref writable
	Write bool
	// hugeTLB is the mmap huge TLB options
	HugeTLB HugeTLBOptions
}

Options contains the options for mmap'ing a file

type Result

type Result struct {
	Result  []byte
	Warning error
}

Result contains the results of a successful mmap

func Bytes

func Bytes(length int64, opts Options) (Result, error)

Bytes requests a private (non-shared) region of anonymous (not backed by a file) memory from the O.S

func Fd

func Fd(fd, offset, length int64, opts Options) (Result, error)

Fd mmaps a file

func File

func File(file *os.File, opts Options) (Result, error)

File mmap's a file

Jump to

Keyboard shortcuts

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