MCPcopy
hub / github.com/google/gvisor / receive

Function receive

pkg/sentry/syscalls/linux/sys_msgqueue.go:108–121  ·  view source on GitHub ↗

receive returns a message from the queue with the given ID. If msgCopy is true, a message is copied from the queue without being removed. Otherwise, a message is removed from the queue and returned.

(t *kernel.Task, id ipc.ID, mType int64, maxSize uint64, flags int32)

Source from the content-addressed store, hash-verified

106// true, a message is copied from the queue without being removed. Otherwise,
107// a message is removed from the queue and returned.
108func receive(t *kernel.Task, id ipc.ID, mType int64, maxSize uint64, flags int32) (*msgqueue.Message, error) {
109 if flags&linux.MSG_COPY != 0 {
110 if flags&(linux.IPC_NOWAIT|linux.MSG_EXCEPT) != linux.IPC_NOWAIT {
111 return nil, linuxerr.EINVAL
112 }
113 }
114
115 queue, err := t.IPCNamespace().MsgqueueRegistry().FindByID(id)
116 if err != nil {
117 return nil, err
118 }
119 pid := int32(t.ThreadGroup().ID())
120 return queue.Receive(t, mType, maxSize, flags, pid)
121}
122
123// Msgctl implements msgctl(2).
124func Msgctl(t *kernel.Task, sysno uintptr, args arch.SyscallArguments) (uintptr, *kernel.SyscallControl, error) {

Callers 1

MsgrcvFunction · 0.85

Calls 6

MsgqueueRegistryMethod · 0.80
IPCNamespaceMethod · 0.80
IDMethod · 0.65
ReceiveMethod · 0.65
FindByIDMethod · 0.45
ThreadGroupMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…