mmap

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2018 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorClosed

type ErrorClosed struct{}

Error occurred when mapping closed.

func (*ErrorClosed) Error

func (err *ErrorClosed) Error() string

Get error message.

type ErrorInvalidMode

type ErrorInvalidMode struct{ Mode Mode }

Error occurred when mapping mode is invalid.

func (*ErrorInvalidMode) Error

func (err *ErrorInvalidMode) Error() string

Get error message.

type ErrorInvalidOffset

type ErrorInvalidOffset struct{ Offset syspack.Offset }

Error occurred when offset is invalid.

func (*ErrorInvalidOffset) Error

func (err *ErrorInvalidOffset) Error() string

Get error message.

type ErrorInvalidOffsetRange

type ErrorInvalidOffsetRange struct{ Low, High syspack.Offset }

Error occurred when offset range is invalid.

func (*ErrorInvalidOffsetRange) Error

func (err *ErrorInvalidOffsetRange) Error() string

Get error message.

type ErrorInvalidSize

type ErrorInvalidSize struct{ Size syspack.Size }

Error occurred when size is invalid.

func (*ErrorInvalidSize) Error

func (err *ErrorInvalidSize) Error() string

Get error message.

type ErrorNotAllowed

type ErrorNotAllowed struct{ Operation string }

Error occurred when operation is not allowed.

func (*ErrorNotAllowed) Error

func (err *ErrorNotAllowed) Error() string

Get error message.

type Mapping

type Mapping struct {
	// contains filtered or unexported fields
}

func NewMapping

func NewMapping(fd uintptr, offset syspack.Offset, size syspack.Size, options *Options) (*Mapping, error)

Make new mapping.

func (*Mapping) CanExecute

func (mapping *Mapping) CanExecute() bool

Whether is mapping execution allowed.

func (*Mapping) CanRead

func (mapping *Mapping) CanRead() bool

Whether is reading from mapping allowed.

func (*Mapping) CanWrite

func (mapping *Mapping) CanWrite() bool

Whether is writing to mapping allowed.

func (*Mapping) Close

func (mapping *Mapping) Close() error

Close mapping.

func (*Mapping) Direct

func (mapping *Mapping) Direct(low, high syspack.Offset) ([]byte, error)

Get direct byte slice in offset range [low, high).

func (*Mapping) Len

func (mapping *Mapping) Len() int

Get mapping length.

func (*Mapping) Lock

func (mapping *Mapping) Lock() error

Lock mapping.

func (*Mapping) ReadAt

func (mapping *Mapping) ReadAt(buffer []byte, offset syspack.Offset) (int, error)

Read len(buffer) bytes from mapping at given offset.

func (*Mapping) ReadByteAt

func (mapping *Mapping) ReadByteAt(offset syspack.Offset) (byte, error)

Read single byte from mapping at given offset.

func (*Mapping) Sync

func (mapping *Mapping) Sync() error

Sync mapping.

func (*Mapping) Unlock

func (mapping *Mapping) Unlock() error

Unlock mapping.

func (*Mapping) WriteAt

func (mapping *Mapping) WriteAt(buffer []byte, offset syspack.Offset) (int, error)

Write len(buffer) bytes to mapping at given offset.

func (*Mapping) WriteByteAt

func (mapping *Mapping) WriteByteAt(byte byte, offset syspack.Offset) error

Write single byte to mapping at given offset.

type Mode

type Mode int

Memory access mode.

const (
	ModeReadOnly Mode = iota
	ModeReadWrite
	ModeReadWritePrivate
)

Available modes.

type Options

type Options struct {

	// Memory access mode.
	Mode Mode

	// Memory is executable.
	Executable bool
}

Jump to

Keyboard shortcuts

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