ipcrm — Remove message queues, semaphore sets, or shared memory IDs

Format

ipcrm [–m SharedMemoryID] [–M SharedMemoryKey] [–q QMessageID] [–Q MessageKey] [–s SemaphoreID] [–S SemaphoreKey]

Description

ipcrm removes one or more message queues, semaphores set, or shared memory identifiers.

Options

–m SharedMemoryID
Removes the shared memory identifier SharedMemoryID. The shared memory segment and data structure associated with SharedMemoryID are also removed after the last detach operation.
–M SharedMemoryKey
Removes the shared memory identifier, created with the key SharedMemoryKey. The shared memory segment and data structure associated with it are also removed after the last detach operation.
–q MessageID
Removes the message queue identifier MessageID and the message queue and data structure associated with it.
–Q MessageKey
Removes the message queue identifier, created with the key MessageKey, and the message queue and data structure associated with it.
–s SemaphoreID
Removes the semaphore identifier SemaphoreID and the set of semaphores and data structure associated with it.
–S SemaphoreKey
Removes the semaphore identifier, created with the key SemaphoreKey, and the set of semaphores and data structure associated with it.

The msgctl, shmctl, and semctl subroutines provide details of the remove operations. You can use the ipcs command to find the identifiers and keys.

Examples

  1. To remove the shared memory segment associated with SharedMemoryID 18602, enter:
    ipcrm –m 18602
  2. To remove the message queue that was created with a key of 0xC1C2C3C3, enter:
    ipcrm –Q 0xC1C2C3C4

Exit values

0
Successful completion
1
Incorrect command-line option

Related information

ipcs