shm

package module
v0.0.0-...-3bf4def Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2014 License: Apache-2.0 Imports: 10 Imported by: 0

README

#shm

The shm package provides various functions to assist with performing shared memory operations in go.

Dependency: github.com/jsgilmore/mount

Build Status

Documentation

Overview

Package shm allows for opening and operating on shared memory devices

Index

Constants

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

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

type Buffer interface {
	Bytes() []byte
	Len() int
	Close() error
	CloseFile() error
	String() string
	File() *os.File
	LocalFile() *os.File
	Advise(offset, length, advice int) error
	Lock(offset, length int) error
	LockAll() error
	Unlock(offset, length int) error
	UnlockAll() error
}

The Buffer interface represents a shared memory buffer

func NewBufferFile

func NewBufferFile(file *os.File, size, prot int) (Buffer, error)

NewBufferFile maps a file to shared memory and returns a handle to the shared memory buffer

func NewBufferHugepages

func NewBufferHugepages(size, prot int) (Buffer, error)

NewBufferTmpfs maps /dev/hugepages into shared memory and returns a handle to the shared memory buffer

func NewBufferMemoryFs

func NewBufferMemoryFs(dir string, size, prot int) (Buffer, error)

NewBufferMemoryFs maps a mounted file system into shared memory and returns a handle to the shared memory buffer

func NewBufferSlice

func NewBufferSlice(size int) Buffer

NewBufferSlice returns a mock shared memory object that is backed by a byte slice, instead of mapped memory Pay carefull attentions to which methods are implemented

func NewBufferTmpfs

func NewBufferTmpfs(size, prot int) (Buffer, error)

NewBufferTmpfs maps /dev/shm into shared memory and returns a handle to the shared memory buffer

Jump to

Keyboard shortcuts

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