stat returns a MsqidDS object filled with information about the queue. An error is returned if the user doesn't have the specified permissions.
(ctx context.Context, ats vfs.AccessTypes)
| 534 | // stat returns a MsqidDS object filled with information about the queue. An |
| 535 | // error is returned if the user doesn't have the specified permissions. |
| 536 | func (q *Queue) stat(ctx context.Context, ats vfs.AccessTypes) (*linux.MsqidDS, error) { |
| 537 | q.mu.Lock() |
| 538 | defer q.mu.Unlock() |
| 539 | |
| 540 | creds := auth.CredentialsFromContext(ctx) |
| 541 | if !q.obj.CheckPermissions(creds, ats) { |
| 542 | // "The caller must have read permission on the message queue." |
| 543 | return nil, linuxerr.EACCES |
| 544 | } |
| 545 | |
| 546 | return &linux.MsqidDS{ |
| 547 | MsgPerm: linux.IPCPerm{ |
| 548 | Key: uint32(q.obj.Key), |
| 549 | UID: uint32(creds.UserNamespace.MapFromKUID(q.obj.OwnerUID)), |
| 550 | GID: uint32(creds.UserNamespace.MapFromKGID(q.obj.OwnerGID)), |
| 551 | CUID: uint32(creds.UserNamespace.MapFromKUID(q.obj.CreatorUID)), |
| 552 | CGID: uint32(creds.UserNamespace.MapFromKGID(q.obj.CreatorGID)), |
| 553 | Mode: uint16(q.obj.Mode), |
| 554 | Seq: 0, // IPC sequences not supported. |
| 555 | }, |
| 556 | MsgStime: q.sendTime.TimeT(), |
| 557 | MsgRtime: q.receiveTime.TimeT(), |
| 558 | MsgCtime: q.changeTime.TimeT(), |
| 559 | MsgCbytes: q.byteCount, |
| 560 | MsgQnum: q.messageCount, |
| 561 | MsgQbytes: q.maxBytes, |
| 562 | MsgLspid: q.sendPID, |
| 563 | MsgLrpid: q.receivePID, |
| 564 | }, nil |
| 565 | } |
| 566 | |
| 567 | // Lock implements ipc.Mechanism.Lock. |
| 568 | func (q *Queue) Lock() { |
no test coverage detected