TrumanWong

ipcrm

Delete a message queue, semaphore set, or shared memory identifier

Supplementary instructions

ipcrm command is used to delete one or more message queues, semaphore sets or shared memory identifiers.

grammar

ipcrm [ -m SharedMemoryID ] [ -M SharedMemoryKey ] [ -q MessageID ] [ -Q MessageKey ] [ -s SemaphoreID ] [ -S SemaphoreKey ]

Options

-m SharedMemory id Delete the shared memory identification SharedMemoryID. The shared memory segments and data structures associated with SharedMemoryID will be deleted after the last detachment operation.
-M SharedMemoryKey Deletes the shared memory identification created with the keyword SharedMemoryKey. The associated shared memory segments and data structure segments will be deleted after the last detachment operation.
-q MessageID Removes the message queue identifier MessageID and its associated message queue and data structures.
-Q MessageKey Removes the message queue ID and its associated message queue and data structures created by the keyword MessageKey.
-s SemaphoreID deletes the semaphore ID SemaphoreID and its related semaphore set and data structure.
-S SemaphoreKey Removes the semaphore identifier created by the keyword SemaphoreKey and its associated semaphore sets and data structures.

The msgctl, shmctl, and semctl subroutines provide the details of the delete operation. Identifiers and keywords can be found using the ipcs command.

Example

If you want to delete the shared memory segment related to SharedMemoryID 18602, enter:

ipcrm -m 18602