Enum ControlCommands

Source
#[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 unless IpcFlags::NoWait is also specified
  • msg_perm.uid - UID of the owner of the queue (not the same as ID of the creator, which is saved in msg_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 in msg_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 kernel
  • int msgmap - maximum number of entries in message map, also unused
  • int 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_qbytes
  • int msgmni - maximum number of message queues
  • int msgssz - message segment size; unused within the Linux kernel
  • int msgtql - maximum number of messages on all queues in system; unused
  • unsigned 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 system
  • msgmap - now returns the total number of messages in all queues across the system
  • msgtql - now returns the total number of bytes used by messages accross the system

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.