MsgInfo reports global parameters for message queues. See msgctl(MSG_INFO).
(ctx context.Context)
| 223 | |
| 224 | // MsgInfo reports global parameters for message queues. See msgctl(MSG_INFO). |
| 225 | func (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). |
no test coverage detected