Kbase P13793: Using ipcs & ipcrm: Checking active message q's,memory, semaphores
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  03/01/2005 |
|
Status: Unverified
GOAL:
Using ipcs & ipcrm: Checking active message q's,memory, semaphores
GOAL:
How to run IPCS Interprocess Communication Facilities Status on UNIX
GOAL:
How to view currently active message queues, shared memory, and semaphores.
GOAL:
Running IPCRM removes a message queue, semaphore set, or shared memory id.
GOAL:
How to remove a shared memory identifier.
FACT(s) (Environment):
UNIX
FIX:
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
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 rld
The output is broken into 6 categories:
1. Type of facility(T): 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 identify the segment can be removed. Use the ipcrm command to remove an IPC object from the kernel. The ipcrm -m is used to remove a shared memory identifier
$ipcrm -m ID#