Documentation
¶
Overview ¶
Package msgqueue implements System V message queues.
Index ¶
- type Message
- func (e *Message) Next() *Message
- func (e *Message) Prev() *Message
- func (e *Message) SetNext(elem *Message)
- func (e *Message) SetPrev(elem *Message)
- func (m *Message) StateFields() []string
- func (m *Message) StateLoad(ctx context.Context, stateSourceObject state.Source)
- func (m *Message) StateSave(stateSinkObject state.Sink)
- func (m *Message) StateTypeName() string
- type Queue
- func (q *Queue) Destroy()
- func (q *Queue) ID() ipc.ID
- func (q *Queue) Lock()
- func (q *Queue) Object() *ipc.Object
- func (q *Queue) Receive(ctx context.Context, mType int64, maxSize uint64, flags, pid int32) (*Message, error)
- func (q *Queue) Send(ctx context.Context, m Message, wait bool, pid int32) error
- func (q *Queue) Set(ctx context.Context, ds *linux.MsqidDS) error
- func (q *Queue) Stat(ctx context.Context) (*linux.MsqidDS, error)
- func (q *Queue) StatAny(ctx context.Context) (*linux.MsqidDS, error)
- func (q *Queue) StateFields() []string
- func (q *Queue) StateLoad(ctx context.Context, stateSourceObject state.Source)
- func (q *Queue) StateSave(stateSinkObject state.Sink)
- func (q *Queue) StateTypeName() string
- func (q *Queue) Unlock()
- type Registry
- func (r *Registry) FindByID(id ipc.ID) (*Queue, error)
- func (r *Registry) FindOrCreate(ctx context.Context, key ipc.Key, mode linux.FileMode, ...) (*Queue, error)
- func (r *Registry) IPCInfo(ctx context.Context) *linux.MsgInfo
- func (r *Registry) MsgInfo(ctx context.Context) *linux.MsgInfo
- func (r *Registry) Remove(id ipc.ID, creds *auth.Credentials) error
- func (r *Registry) StateFields() []string
- func (r *Registry) StateLoad(ctx context.Context, stateSourceObject state.Source)
- func (r *Registry) StateSave(stateSinkObject state.Sink)
- func (r *Registry) StateTypeName() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct {
// Type is an integer representing the type of the sent message.
Type int64
// Text is an untyped block of memory.
Text []byte
// contains filtered or unexported fields
}
Message represents a message exchanged through a Queue via msgsnd(2) and msgrcv(2).
The containing Queue.mu protects the list links while queued. Message has no Queue pointer, so checklocks cannot infer that owner from list membership.
Once enqueued, Type, Text's slice header, and its backing bytes must remain unchanged while queued or while any returned alias is retained. MSG_COPY returns the same Message, so those aliases may outlive a later dequeue.
+stateify savable
func (*Message) Next ¶
func (e *Message) Next() *Message
Next returns the entry that follows e in the list.
func (*Message) Prev ¶
func (e *Message) Prev() *Message
Prev returns the entry that precedes e in the list.
func (*Message) SetNext ¶
func (e *Message) SetNext(elem *Message)
SetNext assigns 'entry' as the entry that follows e in the list.
func (*Message) SetPrev ¶
func (e *Message) SetPrev(elem *Message)
SetPrev assigns 'entry' as the entry that precedes e in the list.
func (*Message) StateFields ¶
func (*Message) StateTypeName ¶
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue represents a SysV message queue, described by sysvipc(7).
+stateify savable
func (*Queue) Destroy ¶
func (q *Queue) Destroy()
Destroy implements ipc.Mechanism.Destroy.
+checklocks:q.mu +checklocksexclude:q.receivers.mu +checklocksexclude:q.senders.mu
func (*Queue) Lock ¶
func (q *Queue) Lock()
Lock implements ipc.Mechanism.Lock.
+checklocksacquire:q.mu
func (*Queue) Receive ¶
func (q *Queue) Receive(ctx context.Context, mType int64, maxSize uint64, flags, pid int32) (*Message, error)
Receive returns the selected Message, removing it unless flags includes MSG_COPY. It does not make an independent copy of the message.
Callers must preserve the payload immutability described by Message, since returned aliases may survive removal. See msgrcv(2).
+checklocksexclude:q.mu +checklocksexclude:q.receivers.mu +checklocksexclude:q.senders.mu
func (*Queue) Send ¶
Send appends a message to the message queue, and returns an error if sending fails. See msgsnd(2).
+checklocksexclude:q.mu +checklocksexclude:q.receivers.mu +checklocksexclude:q.senders.mu
func (*Queue) Set ¶
Set modifies some values of the queue. See msgctl(IPC_SET).
+checklocksexclude:q.mu
func (*Queue) Stat ¶
Stat returns a MsqidDS object filled with information about the queue. See msgctl(IPC_STAT) and msgctl(MSG_STAT).
+checklocksexclude:q.mu
func (*Queue) StatAny ¶
StatAny is similar to Queue.Stat, but doesn't require read permission. See msgctl(MSG_STAT_ANY).
+checklocksexclude:q.mu
func (*Queue) StateFields ¶
func (*Queue) StateTypeName ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry contains a set of message queues that can be referenced using keys or IDs.
+stateify savable
func NewRegistry ¶
func NewRegistry(userNS *auth.UserNamespace) *Registry
NewRegistry returns a new Registry ready to be used.
func (*Registry) FindByID ¶
FindByID returns the queue with the specified ID and an error if the ID doesn't exist.
+checklocksexclude:r.mu
func (*Registry) FindOrCreate ¶
func (r *Registry) FindOrCreate(ctx context.Context, key ipc.Key, mode linux.FileMode, private, create, exclusive bool) (*Queue, error)
FindOrCreate creates a new message queue or returns an existing one. See msgget(2).
+checklocksexclude:r.mu
func (*Registry) IPCInfo ¶
IPCInfo reports global parameters for message queues. See msgctl(IPC_INFO).
func (*Registry) MsgInfo ¶
MsgInfo reports global parameters for message queues. See msgctl(MSG_INFO).
+checklocksexclude:r.mu
func (*Registry) Remove ¶
Remove removes the queue with specified ID. All waiters (readers and writers) and writers will be awakened and fail. Remove will return an error if the ID is invalid, or the user doesn't have privileges.
+checklocksexclude:r.mu