mmap

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: MIT Imports: 3 Imported by: 0

README

mmap

Documentation

Index

Constants

View Source
const (
	PROT_READ  = syscall.PROT_READ
	PROT_WRITE = syscall.PROT_WRITE
)

Variables

This section is empty.

Functions

func Map

func Map(f *os.File, flags int) ([]byte, error)

Mmap creates a memory map of the given file. The flags argument should be a combination of PROT_READ and PROT_WRITE. The size of the map will be the file's size.

func Sync

func Sync(b []byte) (err error)

func Unmap

func Unmap(data []byte) error

Munmap unmaps the data obtained by Map.

Types

type File

type File struct {
	Map []byte
	// contains filtered or unexported fields
}

func Create

func Create(path string, size int64) (*File, error)

func Open

func Open(path string) (*File, error)

Opens a mapped file in read-only mode.

func OpenFile

func OpenFile(
	path string,
	fileFlags int,
	perm os.FileMode,
	size int64,
) (*File, error)

func (*File) Close

func (f *File) Close() error

func (*File) Sync

func (f *File) Sync() error

Jump to

Keyboard shortcuts

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