#[repr(i32)]pub enum ControlCommands {
DeleteQueue = 0,
SetOptions = 1,
GetOptions = 2,
ReturnInfo = 3,
MessageStat = 11,
MessageInfo = 12,
}
Expand description
Commands for use with msgctl()
Variants§
DeleteQueue = 0
Instantly deletes queue, sending a signal to all waiting processes.
In this case, msqid_ds
is completely ignored
and you can theoretically even pass a null pointer
without having to worry
SetOptions = 1
Write the values of some
members of msqid_ds
to
the kernel data structure
Parameters written:
msg_qbytes
- the maximum amount of bytes allowed in the queuue.msgsnd()
calls over the memory limit will block unlessIpcFlags::NoWait
is also specifiedmsg_perm.uid
- UID of the owner of the queue (not the same as ID of the creator, which is saved inmsg_perm.cuid
and can’t be changed)msg_perm.gid
- group ID of the owner of the queue (not the same as GID of the creator, which is saved inmsg_perm.cgid
and can’t be modified)- the 9 least significant bits of
msg_perm.mode
- these are the same mode bits you would encouter when working with files in Unix. Execute bits are ignored
GetOptions = 2
Copies information from the kernel data structure
into the msqid_ds
struct. The caller mus have read
permission on the message queue in the structure
ReturnInfo = 3
Returns systen-wide information about message queue
limits and parameters. In this case, msgctl()
expects
a msginfo
struct as a parameter. Therefore, a cast
is required
This command is Linux specific.
msginfo
has the following members with the following
meanings:
int msgpool
- Size in Kibibites of buffer pool used to hold message data; unused within kernelint msgmap
- maximum number of entries in message map, also unusedint msgmax
- maximum numberr of bytes that can be written in a single message`int msgmnb
- maximum number of bytes that can be written to a queue; used to initialize msg_qbytesint msgmni
- maximum number of message queuesint msgssz
- message segment size; unused within the Linux kernelint msgtql
- maximum number of messages on all queues in system; unusedunsigned short int msgseg
- maximum number of segments; also unusued
The msgmni
, msgmax
and msgmnb
settings can be changed
through /proc
files of the same name. These are
usually located in /proc/sys/kernel
For bigger payloads it is recommended to raise msgmax
MessageStat = 11
Returns a same msgid_ds
struct as ControlCommands::GetOptions
does with the exception that the msqid
argument is not a queue
identifier but instead an index into the kernel’s internal array
This command is Linux specific and rarely used outside of kernel.
MessageInfo = 12
Returns msginfo
struct just like ControlCommands::ReturnInfo
would do, but instead reports information about system resources
consumed by message queues.
This command is Linux specific.
The changed struct members are:
msgpool
- now returns the number of message queues that currently exist on the systemmsgmap
- now returns the total number of messages in all queues across the systemmsgtql
- now returns the total number of bytes used by messages accross the system