shm

package module
v0.0.0-...-1ec4c2b Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: BSD-3-Clause Imports: 2 Imported by: 4

README

go-shm

GoDoc

go-shm provides functions to open and unlink shared memory without relying on cgo (on Linux). It provides an implementation of shm_open and shm_unlink from sys/mman.h.

Download

go get github.com/tmthrgd/go-shm

License

Unless otherwise noted, the go-shm source files are distributed under the Modified BSD License found in the LICENSE file.

Documentation

Overview

Package shm provides functions to open and unlink shared memory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(name string, flag int, perm os.FileMode) (*os.File, error)

Taken from shm_open(3):

shm_open() creates and opens a new, or opens an existing, POSIX shared
memory object. A POSIX shared memory object is in effect a handle which
can be used by unrelated processes to mmap(2) the same region of shared
memory. The shm_unlink() function performs the converse operation,
removing an object previously created by shm_open().

The operation of shm_open() is analogous to that of open(2). name
specifies the shared memory object to be created or opened. For
portable use, a shared memory object should be identified by a name of
the form /somename; that is, a null-terminated string of up to NAME_MAX
(i.e., 255) characters consisting of an initial slash, followed by one
or more characters, none of which are slashes.
func Unlink(name string) error

Taken from shm_unlink(3):

The  operation  of shm_unlink() is analogous to unlink(2): it removes a
shared memory object name, and, once all processes  have  unmapped  the
object, de-allocates and destroys the contents of the associated memory
region.  After a successful shm_unlink(),  attempts  to  shm_open()  an
object  with  the same name will fail (unless O_CREAT was specified, in
which case a new, distinct object is created).

Types

This section is empty.

Jump to

Keyboard shortcuts

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