[][src]Enum ipc_rs::raw::ControlCommands

#[repr(i32)]
pub enum ControlCommands {
    DeleteQueue,
    SetOptions,
    GetOptions,
    ReturnInfo,
    MessageStat,
    MessageInfo,
}

Commands for use with msgctl()

Variants

DeleteQueue

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

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

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

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

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

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

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]