package msgqueue
import "gvisor.dev/gvisor/pkg/sentry/kernel/msgqueue"
Package msgqueue implements System V message queues.
Index ¶
- type Blocker
- type Message
- type Queue
- func (q *Queue) Copy(mType int64) (*Message, error)
- 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, b Blocker, mType int64, maxSize int64, wait, truncate, except bool, pid int32) (*Message, error)
- func (q *Queue) Send(ctx context.Context, m Message, b Blocker, 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) Unlock()
- type Registry
- func NewRegistry(userNS *auth.UserNamespace) *Registry
- func (r *Registry) FindByID(id ipc.ID) (*Queue, error)
- func (r *Registry) FindOrCreate(ctx context.Context, key ipc.Key, mode linux.FileMode, private, create, exclusive bool) (*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
Types ¶
type Blocker ¶
type Blocker interface { Block(C <-chan struct{}) error }
Blocker is used for blocking Queue.Send, and Queue.Receive calls that serves as an abstracted version of kernel.Task. kernel.Task is not directly used to prevent circular dependencies.
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 // Size is the size of Text. Size uint64 // contains filtered or unexported fields }
Message represents a message exchanged through a Queue via msgsnd(2) and msgrcv(2).
+stateify savable
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue represents a SysV message queue, described by sysvipc(7).
+stateify savable
func (*Queue) Copy ¶
Copy copies a message from the queue without deleting it. If no message exists, an error is returned. See msgrcv(MSG_COPY).
func (*Queue) Destroy ¶
func (q *Queue) Destroy()
Destroy implements ipc.Mechanism.Destroy.
func (*Queue) ID ¶
ID returns queue's ID.
func (*Queue) Lock ¶
func (q *Queue) Lock()
Lock implements ipc.Mechanism.Lock.
func (*Queue) Object ¶
Object implements ipc.Mechanism.Object.
func (*Queue) Receive ¶
func (q *Queue) Receive(ctx context.Context, b Blocker, mType int64, maxSize int64, wait, truncate, except bool, pid int32) (*Message, error)
Receive removes a message from the queue and returns it. See msgrcv(2).
func (*Queue) Send ¶
Send appends a message to the message queue, and returns an error if sending fails. See msgsnd(2).
func (*Queue) Set ¶
Set modifies some values of the queue. See msgctl(IPC_SET).
func (*Queue) Stat ¶
Stat returns a MsqidDS object filled with information about the queue. See msgctl(IPC_STAT) and msgctl(MSG_STAT).
func (*Queue) StatAny ¶
StatAny is similar to Queue.Stat, but doesn't require read permission. See msgctl(MSG_STAT_ANY).
func (*Queue) Unlock ¶
func (q *Queue) Unlock()
Unlock implements ipc.mechanism.Unlock.
+checklocksignore
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.
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).
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).
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.
Source Files ¶
msgqueue.go
- Version
- v0.0.0-20250605235530-a6711d1e1dc6 (latest)
- Published
- Jun 5, 2025
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 4 hours ago –
Tools for package owners.