mmap

package
v0.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

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

	MAP_SHARED  = syscall.MAP_SHARED
	MAP_PRIVATE = syscall.MAP_PRIVATE
	MAP_COPY    = MAP_PRIVATE
)

Variables

This section is empty.

Functions

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 Fsize

func Fsize(f *os.File) int

Fsize returns the file size.

func Mmap

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

Mmap calls the mmap system call.

func Msync

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

Msync calls the msync system call.

func Munmap

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