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

Method MsgInfo

pkg/sentry/kernel/msgqueue/msgqueue.go:225–250  ·  view source on GitHub ↗

MsgInfo reports global parameters for message queues. See msgctl(MSG_INFO).

(ctx context.Context)

Source from the content-addressed store, hash-verified

223
224// MsgInfo reports global parameters for message queues. See msgctl(MSG_INFO).
225func (r *Registry) MsgInfo(ctx context.Context) *linux.MsgInfo {
226 r.mu.Lock()
227 defer r.mu.Unlock()
228
229 var messages, bytes uint64
230 r.reg.ForAllObjects(
231 func(o ipc.Mechanism) {
232 q := o.(*Queue)
233 q.mu.Lock()
234 messages += q.messageCount
235 bytes += q.byteCount
236 q.mu.Unlock()
237 },
238 )
239
240 return &linux.MsgInfo{
241 MsgPool: int32(r.reg.ObjectCount()),
242 MsgMap: int32(messages),
243 MsgTql: int32(bytes),
244 MsgMax: linux.MSGMAX,
245 MsgMnb: linux.MSGMNB,
246 MsgMni: linux.MSGMNI,
247 MsgSsz: linux.MSGSSZ,
248 MsgSeg: linux.MSGSEG,
249 }
250}
251
252// Send appends a message to the message queue, and returns an error if sending
253// fails. See msgsnd(2).

Callers 1

MsgctlFunction · 0.80

Calls 4

ForAllObjectsMethod · 0.80
ObjectCountMethod · 0.80
LockMethod · 0.65
UnlockMethod · 0.65

Tested by

no test coverage detected