sysvipc

package module
v0.0.0-...-54842cc Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package sysvipc provides access to System V inter-process communication mechanisms.

Index

Constants

View Source
const (
	IPC_CREAT  = unix.IPC_CREAT  // Create entry if key does not exist
	IPC_EXCL   = unix.IPC_EXCL   // Fail if key exists
	IPC_NOWAIT = unix.IPC_NOWAIT // Error if request must wait
)

Mode bits.

View Source
const (
	IPC_RMID = unix.IPC_RMID // Remove identifier
	IPC_SET  = unix.IPC_SET  // Set options
	IPC_STAT = unix.IPC_STAT // Get options
)

Control commands.

View Source
const (
	IPC_R = 0o000400 // Read permission
	IPC_W = 0o000200 // Write/alter permission
	IPC_M = 0o010000 // Modify control info permission
)

Common mode bits.

View Source
const (
	MSG_STAT     = 11
	MSG_INFO     = 12
	MSG_STAT_ANY = 13
)

Additional commands for Msgctl.

View Source
const (
	GETPID       = 11 // get sempid
	GETVAL       = 12 // get semval
	GETALL       = 13 // get all semval's
	GETNCNT      = 14 // get semncnt
	GETZCNT      = 15 // get semzcnt
	SETVAL       = 16 // set semval
	SETALL       = 17 // set all semval's
	SEM_STAT     = 18
	SEM_INFO     = 19
	SEM_STAT_ANY = 20
)

Additional commands for semctl.

View Source
const (
	SEM_DEST   = 0o2000 // Semaphore will be destroyed on last detach
	SEM_LOCKED = 0o4000 // Semaphore set is locked
)
View Source
const (
	SHM_RDONLY = unix.SHM_RDONLY // read-only access
	SHM_RND    = unix.SHM_RND    // round attach address to SHMLBA boundary
)

Possible flag values for Shmat.

View Source
const (
	SHM_REMAP = 0o040000  // take-over region on attach
	SHM_EXEC  = 0o0100000 // execution access
)

Additional flag values for Shmat.

View Source
const (
	SHM_LOCK     = 11
	SHM_UNLOCK   = 12
	SHM_STAT     = 13
	SHM_INFO     = 14
	SHM_STAT_ANY = 15
)

Additional commands for Shmctl.

View Source
const (
	IPC_INFO = 3
)

Additional commands for Msgctl, Semctl, Shmctl.

View Source
const IPC_PRIVATE = unix.IPC_PRIVATE

Private key.

If this special value is used for key, the system call ignores everything but the least significant 9 bits of the flag argument to Msgget, Semget or Shmget and creates a new message queue, semaphore set or shared memory segment.

View Source
const (
	MSG_NOERROR = 0o010000 // no error if message is too big
)

Possible values for the fifth parameter to Msgrcv, in addition to the IPC_NOWAIT flag, which is permitted.

View Source
const (
	SEM_UNDO = 0x1000 // undo the operation on exit
)

Possible flag values for Semop.

Variables

This section is empty.

Functions

func Ftok

func Ftok(path string, id uint8) (int, error)

Ftok creates IPC identifier from path name.

func Msgctl

func Msgctl(id, cmd int, arg any) (int, error)

Msgctl corresponds to msgctl.

arg can be of type:

*MsgControl    IPC_STAT, IPC_SET, MSG_STAT, MSG_STAT_ANY
*MsgInfo       IPC_INFO, MSG_INFO

func Msgget

func Msgget(key, flag int) (int, error)

Msgget corresponds to msgget.

func Msgrcv

func Msgrcv(id int, msg []byte, typ, flag int) (int, error)

Msgrcv corresponds to msgrcv.

func Msgsnd

func Msgsnd(id int, msg []byte, flag int) error

Msgsnd corresponds to msgsnd.

func Semctl

func Semctl(id, num, cmd int, arg any) (int, error)

Semctl corresponds to semctl.

arg can be of type:

*SemControl    IPC_STAT, IPC_SET, SEM_STAT, SEM_STAT_ANY
*SemInfo       IPC_INFO, SEM_INFO
[]uint16       GETALL, SETALL
int32          SETVAL

func Semget

func Semget(key, nsems, flag int) (int, error)

Semget corresponds to semget.

func Semop

func Semop(id int, ops []Sembuf) error

Semop corresponds to semop.

func Semtimedmop

func Semtimedmop(id int, ops []Sembuf, timeout time.Duration) (err error)

Semtimedop corresponds to semtimedop.

func Shmat

func Shmat(id int, addr uintptr, flag int) ([]byte, error)

Shmat corresponds to shmat.

func Shmctl

func Shmctl(id, cmd int, arg any) (int, error)

Shmctl corresponds to shmctl.

arg can be of type:

*ShmControl    IPC_STAT, IPC_SET, SHM_STAT, SHM_STAT_ANY
*ShmInfo       IPC_INFO, SHM_INFO

func Shmdt

func Shmdt(data []byte) error

Shmdt corresponds to shmdt.

func Shmget

func Shmget(key, size, flag int) (int, error)

Shmget corresponds to shmget.

Types

type MsgDesc

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

MsgDesc corresponds to struct msqid_ds.

func (*MsgDesc) Lrpid

func (m *MsgDesc) Lrpid() int

func (*MsgDesc) Lspid

func (m *MsgDesc) Lspid() int

func (*MsgDesc) Perm

func (m *MsgDesc) Perm() *Perm

type MsgInfo

type MsgInfo struct {
	Pool int32  // size in kibibytes of buffer pool (unused within kernel)
	Map  int32  // max number of entries in message map (unused within kernel)
	Max  int32  // max number of bytes per message
	Mnb  int32  // max number of bytes on queue
	Mni  int32  // max number of message queues
	Ssz  int32  // message segment size (unused within kernel)
	Tql  int32  // max number of messages on all queues (unused within kernel)
	Seg  uint16 // max number of segments (unused within kernel)
	// contains filtered or unexported fields
}

MsgInfo corresponds to struct msginfo.

type Perm

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

Perm corresponds to struct ipc_perm.

func (*Perm) Cgid

func (p *Perm) Cgid() int

func (*Perm) Cuid

func (p *Perm) Cuid() int

func (*Perm) Gid

func (p *Perm) Gid() int

func (Perm) Key

func (p Perm) Key() int

func (*Perm) Mode

func (p *Perm) Mode() int

func (Perm) Seq

func (p Perm) Seq() int

func (*Perm) SetGid

func (p *Perm) SetGid(gid int)

func (*Perm) SetMode

func (p *Perm) SetMode(mode int)

func (*Perm) SetUid

func (p *Perm) SetUid(uid int)

func (*Perm) Uid

func (p *Perm) Uid() int

type SemDesc

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

SemDesc corresponds to struct semid_ds.

type SemInfo

type SemInfo struct {
	Map int32 // Number of entries in semaphore map; unused within kernel
	Mni int32 // Maximum number of semaphore sets
	Mns int32 // Maximum number of semaphores in all semaphore sets
	Mnu int32 // System-wide maximum number of undo structures; unused within kernel
	Msl int32 // Maximum number of semaphores in a set
	Opm int32 // Maximum number of operations for semop
	Ume int32 // Maximum number of undo entries per process; unused within kernel
	Usz int32 // Size of struct sem_undo
	Vmx int32 // Maximum semaphore value
	Aem int32 // Maximum value that can be recorded for semaphore adjustment (SEM_UNDO)
	// contains filtered or unexported fields
}

type Sembuf

type Sembuf struct {
	Num uint16
	Op  int16
	Flg int16
}

Sembuf corresponds to struct sembuf.

type ShmDesc

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

ShmDesc corresponds to struct shmid_ds.

func (*ShmDesc) Cpid

func (s *ShmDesc) Cpid() int

func (*ShmDesc) Lpid

func (s *ShmDesc) Lpid() int

func (*ShmDesc) Nattch

func (s *ShmDesc) Nattch() uint64

func (*ShmDesc) Perm

func (s *ShmDesc) Perm() *Perm

func (*ShmDesc) Segsz

func (s *ShmDesc) Segsz() uint64

type ShmInfo

type ShmInfo struct {
	UsedIDs       int32 // number of currently existing segments
	ShmTot        uint  // total number of shared memory pages
	ShmRss        uint  // number of resident shared memory pages
	ShmSwp        uint  // number of swapped shared memory pages
	SwapAttempts  uint  // unused since Linux 2.4
	SwapSuccesses uint  // unused since Linux 2.4
	// contains filtered or unexported fields
}

ShmInfo corresponds to struct shm_info.

type ShmSystemInfo

type ShmSystemInfo struct {
	Max uint // maximum segment size
	Min uint // minimum segment size; always 1
	Mni uint // maximum number of segments
	Seg uint // maximum number of segments that a process can attach (unused within kernel)
	All uint // maximum number of pages of shared memory, system-wide
	// contains filtered or unexported fields
}

ShmSystemInfo corresponds to struct shminfo64.

Jump to

Keyboard shortcuts

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