mmap

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtRead  = syscall.PROT_READ
	ProtWrite = syscall.PROT_WRITE
	ProtExec  = syscall.PROT_EXEC

	MapShared  = syscall.MAP_SHARED
	MapPrivate = syscall.MAP_PRIVATE
	MapCopy    = MapPrivate
)

Variables

This section is empty.

Functions

func FSize added in v0.0.2

func FSize(f *os.File) int

FSize returns the file size.

func Fd

func Fd(f *os.File) int

Fd returns the integer file descriptor referencing the open file. The file descriptor is valid only until f.Close is called or f is garbage collected.

func MMap added in v0.0.2

func MMap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error)

MMap calls the MMap system call.

func MSync added in v0.0.2

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

MSync calls the msync system call.

func MUnmap added in v0.0.2

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

MUnmap calls the MUnmap system call.

func Offset

func Offset(offset int64) int64

Offset returns the valid offset.

func Open

func Open(fd int, offset int64, length int, p Prot) (data []byte, err error)

Open opens a MMap

func ProtFlags

func ProtFlags(p Prot) (prot int, flags int)

ProtFlags returns prot and flags by Prot p.

Types

type Prot

type Prot int

Prot is the protection flag.

const (
	// READ represents the read prot
	READ Prot = 1 << iota
	// WRITE represents the write prot
	WRITE
	// COPY represents the copy prot
	COPY
	// EXEC represents the exec prot
	EXEC
)

Jump to

Keyboard shortcuts

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