Documentation
¶
Overview ¶
This package's API is not finalized. Unless vendoring the code and locking down the commit/version with godep or similar, it's not safe to import this package yet.
Index ¶
- Variables
- func Ftok(pathname string, projID uint8) (int64, error)
- type IpcPerms
- type MQFlags
- type MQInfo
- type MQRecvFlags
- type MQSendFlags
- type MessageQueue
- func (mq MessageQueue) Receive(maxlen uint, msgtyp int64, flags *MQRecvFlags) ([]byte, int64, error)
- func (mq MessageQueue) Remove() error
- func (mq MessageQueue) Send(mtyp int64, body []byte, flags *MQSendFlags) error
- func (mq MessageQueue) Set(mqi *MQInfo) error
- func (mq MessageQueue) Stat() (*MQInfo, error)
- type SHMAttachFlags
- type SHMFlags
- type SHMInfo
- type SemOpFlags
- type SemOps
- type SemSetFlags
- type SemSetInfo
- type SemaphoreSet
- func (ss *SemaphoreSet) GetNCnt(num uint16) (int, error)
- func (ss *SemaphoreSet) GetZCnt(num uint16) (int, error)
- func (ss *SemaphoreSet) Getall() ([]uint16, error)
- func (ss *SemaphoreSet) Getpid(num uint16) (int, error)
- func (ss *SemaphoreSet) Getval(num uint16) (int, error)
- func (ss *SemaphoreSet) Remove() error
- func (ss *SemaphoreSet) Run(ops *SemOps, timeout time.Duration) error
- func (ss *SemaphoreSet) Set(ssi *SemSetInfo) error
- func (ss *SemaphoreSet) Setall(values []uint16) error
- func (ss *SemaphoreSet) Setval(num uint16, value int) error
- func (ss *SemaphoreSet) Stat() (*SemSetInfo, error)
- type SharedMem
- type SharedMemMount
- func (shma *SharedMemMount) AtomicReadUint32() (uint32, error)
- func (shma *SharedMemMount) AtomicWriteUint32(v uint32) error
- func (shma *SharedMemMount) Close() error
- func (shma *SharedMemMount) Read(p []byte) (int, error)
- func (shma *SharedMemMount) ReadByte() (byte, error)
- func (shma *SharedMemMount) Seek(offset int64, whence int) (int64, error)
- func (shma *SharedMemMount) UnreadByte() error
- func (shma *SharedMemMount) Write(p []byte) (int, error)
- func (shma *SharedMemMount) WriteByte(c byte) error
Constants ¶
This section is empty.
Variables ¶
var (
ErrReadOnlyShm = errors.New("Read-Only shared mem attachment")
)
Functions ¶
Types ¶
type MQFlags ¶
type MQFlags struct {
// Create controls whether to create the queue if it doesn't exist.
Create bool
// Exclusive causes GetMsgQueue to fail if the queue already exists (only
// useful with Create).
Exclusive bool
// Perms is the file-style (rwxrwxrwx) permissions with which to create the
// queue (also only useful with Create).
Perms int
}
MQFlags holds the flags/options for GetMsgQueue
type MQInfo ¶
type MQInfo struct {
Perms IpcPerms
LastSend time.Time
LastRcv time.Time
LastChange time.Time
MsgCount uint
MaxBytes uint
LastSender int
LastRcver int
}
MQInfo holds meta information about a message queue.
type MQRecvFlags ¶
type MQRecvFlags struct {
// DontWait causes Receive() calls that would otherwise
// block to instead fail with syscall.EAGAIN or syscall.ENOMSG
DontWait bool
// Truncate allows shortening the message if maxlen is
// shorter than the message being received
Truncate bool
}
MQRecvFlags hold the options for a MessageQueue.Receive()
type MQSendFlags ¶
type MQSendFlags struct {
// DontWait causes Send() calls that would otherwise
// block to instead fail with syscall.EAGAIN
DontWait bool
}
MQSendFlags hold the options for a MessageQueue.Send()
type MessageQueue ¶
type MessageQueue int64
MessageQueue is a kernel-maintained queue.
func GetMsgQueue ¶
func GetMsgQueue(key int64, flags *MQFlags) (MessageQueue, error)
GetMsgQueue creates or retrieves a message queue id for a given IPC key.
func (MessageQueue) Receive ¶
func (mq MessageQueue) Receive(maxlen uint, msgtyp int64, flags *MQRecvFlags) ([]byte, int64, error)
Receive retrieves a message from the queue.
func (MessageQueue) Remove ¶
func (mq MessageQueue) Remove() error
Remove deletes the queue. This will also awake all waiting readers and writers with EIDRM.
func (MessageQueue) Send ¶
func (mq MessageQueue) Send(mtyp int64, body []byte, flags *MQSendFlags) error
Send places a new message onto the queue
func (MessageQueue) Set ¶
func (mq MessageQueue) Set(mqi *MQInfo) error
Set updates parameters of the queue.
func (MessageQueue) Stat ¶
func (mq MessageQueue) Stat() (*MQInfo, error)
Stat produces information about the queue.
type SHMAttachFlags ¶
type SHMAttachFlags struct {
// ReadOnly causes the new SharedMemMount to be readable but not writable
ReadOnly bool
}
SHMAttachFlags holds the options for SharedMem.Attach
type SHMFlags ¶
type SHMFlags struct {
// Create controls whether to create the shared memory segment if it
// doesn't already exist.
Create bool
// Exclusive causes GetSharedMem to fail if the shared memory already
// exists (only useful with Create).
Exclusive bool
// Perms is the file-style (rwxrwxrwx) permissions with which to create the
// shared memory segment (also only useful with Create).
Perms int
}
SHMFlags holds the options for GetSharedMem
type SHMInfo ¶
type SHMInfo struct {
Perms IpcPerms
SegmentSize uint
LastAttach time.Time
LastDetach time.Time
LastChange time.Time
CreatorPID int
LastUserPID int
CurrentAttaches uint
}
SHMInfo holds meta information about a shared memory segment.
type SemOpFlags ¶
type SemOpFlags struct {
// DontWait causes calls that would otherwise block
// to instead fail with syscall.EAGAIN
DontWait bool
}
SemOpFlags holds the options for SemOp methods
type SemOps ¶
type SemOps []C.struct_sembuf
SemOps is a collection of operations submitted to SemaphoreSet.Run.
func (*SemOps) Decrement ¶
func (so *SemOps) Decrement(num uint16, by int16, flags *SemOpFlags) error
Decrement adds an operation that will decrease a semaphore's number.
type SemSetFlags ¶
type SemSetFlags struct {
// Create controls whether to create the set if it doens't already exist.
Create bool
// Exclusive causes GetSemSet to fail if the semaphore set already exists
// (only useful with Create).
Exclusive bool
// Perms is the file-style (rwxrwxrwx) permissions with which to create the
// semaphore set (also only useful with Create).
Perms int
}
SemSetFlags holds the options for a GetSemSet() call
type SemSetInfo ¶
SemSetInfo holds meta information about a semaphore set.
type SemaphoreSet ¶
type SemaphoreSet struct {
// contains filtered or unexported fields
}
SemaphoreSet is a kernel-maintained collection of semaphores.
func GetSemSet ¶
func GetSemSet(key, count int64, flags *SemSetFlags) (*SemaphoreSet, error)
GetSemSet creates or retrieves the semaphore set for a given IPC key.
func (*SemaphoreSet) GetNCnt ¶
func (ss *SemaphoreSet) GetNCnt(num uint16) (int, error)
GetNCnt returns the # of those blocked Decrementing the num-th semaphore
func (*SemaphoreSet) GetZCnt ¶
func (ss *SemaphoreSet) GetZCnt(num uint16) (int, error)
GetZCnt returns the # of those blocked on WaitZero on the num-th semaphore
func (*SemaphoreSet) Getall ¶
func (ss *SemaphoreSet) Getall() ([]uint16, error)
Getall retrieves the values of all the semaphores in the set
func (*SemaphoreSet) Getpid ¶
func (ss *SemaphoreSet) Getpid(num uint16) (int, error)
Getpid returns the last process id to operate on the num-th semaphore
func (*SemaphoreSet) Getval ¶
func (ss *SemaphoreSet) Getval(num uint16) (int, error)
Getval retrieves the value of a single semaphore in the set
func (*SemaphoreSet) Remove ¶
func (ss *SemaphoreSet) Remove() error
Remove deletes the semaphore set. This will also awake anyone blocked on the set with EIDRM.
func (*SemaphoreSet) Run ¶
func (ss *SemaphoreSet) Run(ops *SemOps, timeout time.Duration) error
Run applies a group of SemOps atomically.
func (*SemaphoreSet) Set ¶
func (ss *SemaphoreSet) Set(ssi *SemSetInfo) error
Set updates parameters of the semaphore set.
func (*SemaphoreSet) Setall ¶
func (ss *SemaphoreSet) Setall(values []uint16) error
Setall sets the values of every semaphore in the set
func (*SemaphoreSet) Setval ¶
func (ss *SemaphoreSet) Setval(num uint16, value int) error
Setval sets the value of a single semaphore in the set
func (*SemaphoreSet) Stat ¶
func (ss *SemaphoreSet) Stat() (*SemSetInfo, error)
Stat produces information about the semaphore set.
type SharedMem ¶
type SharedMem struct {
// contains filtered or unexported fields
}
SharedMem is an allocated block of memory sharable with multiple processes.
func GetSharedMem ¶
GetSharedMem creates or retrieves the shared memory segment for an IPC key
func (*SharedMem) Attach ¶
func (shm *SharedMem) Attach(flags *SHMAttachFlags) (*SharedMemMount, error)
Attach brings a shared memory segment into the current process's memory space.
func (*SharedMem) Remove ¶
Remove marks the shared memory segment for removal. It will be removed when all attachments have been closed.
type SharedMemMount ¶
type SharedMemMount struct {
// contains filtered or unexported fields
}
SharedMemMount is the pointer to an attached block of shared memory space.
func (*SharedMemMount) AtomicReadUint32 ¶
func (shma *SharedMemMount) AtomicReadUint32() (uint32, error)
AtomicReadUint32 returns an uint32 value from the current position of the shared memory segment using atomic read (see "sync/atomic").
func (*SharedMemMount) AtomicWriteUint32 ¶
func (shma *SharedMemMount) AtomicWriteUint32(v uint32) error
AtomicWriteUint32 places an uint32 value into the shared memory segment atomically (see "sync/atomic").
func (*SharedMemMount) Close ¶
func (shma *SharedMemMount) Close() error
Close detaches the shared memory segment pointer.
func (*SharedMemMount) Read ¶
func (shma *SharedMemMount) Read(p []byte) (int, error)
Read pulls bytes out of the shared memory segment.
func (*SharedMemMount) ReadByte ¶
func (shma *SharedMemMount) ReadByte() (byte, error)
ReadByte returns a single byte from the current position in shared memory.
func (*SharedMemMount) Seek ¶
func (shma *SharedMemMount) Seek(offset int64, whence int) (int64, error)
Seek moves the current position in shared memory, according to "whence": - 0 makes the offset relative to the beginning - 1 makes it relative to the current position - 2 makes it relative to the end of the segment
func (*SharedMemMount) UnreadByte ¶
func (shma *SharedMemMount) UnreadByte() error
UnreadByte sets the position back to before a ReadByte.
func (*SharedMemMount) Write ¶
func (shma *SharedMemMount) Write(p []byte) (int, error)
Write places bytes into the shared memory segment.
func (*SharedMemMount) WriteByte ¶
func (shma *SharedMemMount) WriteByte(c byte) error
WriteByte places a single byte at the current position in shared memory.