IPCS, the Interprocess Communication Facilities Status is a UNIX Operating System utility used to analyze the status of active interprocess communications facilities.
The ipcs command lists active IPC services: message queues, shared memory, and semaphores. This information is used to evaluate system resources and to identify the id of the shared memory, message queue, or semaphores targeted for removal.
Issue the ipcs command:
$ ipcs -a
Example Output:IPC status from running system
T ID KEY MODE OWNER GROUP
Message Queues:
q 0 0x4c544952 -Rrw-rw-rw- root root
Shared Memory:
m 0 0x5643 --rw-rw-rw- root root
m 1 0x5654 --rw-rw-rw- root root
m 2 0x4d4e5251 --rw-r--r-- root root
m 3 0x55315352 --rw-rw-rw- root root
Semaphores:
s 1 0x4453314d --ra------- root root
s 2 0x55535253 --ra-ra-ra- root root
s 28835844 0 --ra-ra-ra- usr2 rld
s 9306117 0 --ra-ra-ra- usr1 rld
s 573571078 0 --ra-ra-ra- usr rldThe output is broken into 6 categories:1.
T Type of facility:
- q message queue,
- m shared memory segment,
- s semaphore
2.
ID: The identifier for the facility entry.
3.
Key: The key used as an argument msgget(2), semget(2), or shmget(2) to create the facility.
4.
Mode: The facility access modes and flags; the mode consists of 11 characters that are interpreted as follows:
The first 2 characters are:
R - If a process is waiting on a msgrcv
S - If aa process is waiting on a msgsnd
D - If the associated shared memory segment has been removed. It disappears when the last process attached to the segment detaches it.
The next 9 characters are allocated for permissions:
r - If read permissions is granted
w - If write permissions is granted
a - If alter permissions is granted
- - If the indicted permission is not granted
5.
Owner: The login name of the owner of the facility entry
6.
Group: The group name of the group of the owner of the facility entry
Once the ID has been identified, the segment can be removed with the ipcrm command. to remove an IPC object from the kernel.
To remove a shared memory identifier
$ ipcrm -m ID#
To remove a semaphore
$ ipcrm -s <ID>