Documentation
¶
Overview ¶
Package shm implements shared memory objects.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DestroyMemoryObject ¶
DestroyMemoryObject permanently removes given memory object.
Types ¶
type MemoryObject ¶
type MemoryObject struct {
// contains filtered or unexported fields
}
MemoryObject represents an object which can be used to map shared memory regions into the process' address space.
func NewMemoryObject ¶
NewMemoryObject creates a new shared memory object.
name - a name of the object. should not contain '/' and exceed 255 symbols (30 on darwin). size - object size. flag - flag is a combination of open flags from 'os' package. perm - object's permission bits.
func (*MemoryObject) Close ¶
func (obj *MemoryObject) Close() error
Close closes object's underlying file object. Darwin: a call to Close() causes invalid argument error, if the object was not truncated. So, in this case we return nil as an error.
func (*MemoryObject) Destroy ¶
func (obj *MemoryObject) Destroy() error
Destroy closes the object and removes it permanently.
func (*MemoryObject) Fd ¶
func (obj *MemoryObject) Fd() uintptr
Fd returns a descriptor of the object's underlying file object.
func (*MemoryObject) Name ¶
func (obj *MemoryObject) Name() string
Name returns the name of the object as it was given to NewMemoryObject().
func (*MemoryObject) Size ¶
func (obj *MemoryObject) Size() int64
Size returns the current object size. Darwin: it may differ from the size passed passed to Truncate.
func (*MemoryObject) Truncate ¶
func (obj *MemoryObject) Truncate(size int64) error
Truncate resizes the shared memory object. Darwin: it is possible to truncate an object only once after it was created. Darwin: the size should be divisible by system page size, otherwise the size is set to the nearest page size devider greater, then the given size.
type SharedMemoryObject ¶
SharedMemoryObject is an interface, which must be implemented by ant implemetation of an object used for mapping into memory.