MCPcopy Index your code
hub / github.com/google/gvisor / Msgrcv

Function Msgrcv

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

Msgrcv implements msgrcv(2).

(t *kernel.Task, sysno uintptr, args arch.SyscallArguments)

Source from the content-addressed store, hash-verified

78
79// Msgrcv implements msgrcv(2).
80func Msgrcv(t *kernel.Task, sysno uintptr, args arch.SyscallArguments) (uintptr, *kernel.SyscallControl, error) {
81 id := ipc.ID(args[0].Int())
82 msgAddr := args[1].Pointer()
83 size := args[2].Uint64()
84 mType := args[3].Int64()
85 flags := args[4].Int()
86
87 msg, err := receive(t, id, mType, size, flags)
88 if err != nil {
89 return 0, nil, err
90 }
91
92 buf := linux.MsgBuf{
93 Type: primitive.Int64(msg.Type),
94 Text: msg.Text,
95 }
96 if uint64(len(buf.Text)) > size {
97 buf.Text = buf.Text[:size]
98 }
99 if _, err := buf.CopyOut(t, msgAddr); err != nil {
100 return 0, nil, err
101 }
102 return uintptr(len(buf.Text)), nil, nil
103}
104
105// receive returns a message from the queue with the given ID. If msgCopy is
106// true, a message is copied from the queue without being removed. Otherwise,

Callers

nothing calls this directly

Calls 8

IDTypeAlias · 0.92
Int64TypeAlias · 0.92
receiveFunction · 0.85
CopyOutMethod · 0.65
IntMethod · 0.45
PointerMethod · 0.45
Uint64Method · 0.45
Int64Method · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…