1753784 Members
7399 Online
108799 Solutions
New Discussion юеВ

understand ipcs command

 
SOLVED
Go to solution
Pattabhi
Frequent Advisor

understand ipcs command

Gurus,

Could some one help me understand what the coloum status means and what does it mean (dest)in the below output?

#ipcs

------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 458752 gdm 600 393216 2 dest
0xa6d143fc 524289 oracle 660 2149580800 22
0x00000000 557058 root 600 196608 2 dest
0x00000000 589827 root 600 196608 2 dest
0x00000000 622596 root 600 196608 2 dest
0x00000000 655365 root 600 196608 2 dest
0x00000000 688134 root 600 196608 2 dest
0x00000000 720903 root 600 196608 2 dest
0x00000000 753672 root 600 196608 2 dest
0x00000000 819210 root 600 196608 2 dest
0x5e069a14 917515 root 600 512 1

------ Semaphore Arrays --------
key semid owner perms nsems
0x71069a02 0 root 666 1
0xf01656e0 131073 oracle 660 154
0x550a01de 163842 root 666 1

------ Message Queues --------
key msqid owner perms used-bytes messages

3 REPLIES 3
Pattabhi
Frequent Advisor

Re: understand ipcs command

This output is on RHAS 5.1 and the kernel version is 2.6.18-53.1.6.el5.

I need to know the meaning of the Status coloum and what (dest) means in th ebelow output.

regards,
Pattabhi Raman
Matti_Kurkela
Honored Contributor
Solution

Re: understand ipcs command

I'm not sure (could not find any documentation that says this explicitly), but I guess it means the segment has been marked as "to be destroyed" using shmctl(shmid, IPC_RMID,...) system call.

"man 2 shmctl" says this about IPC_RMID:
-----------
IPC_RMID
Mark the segment to be destroyed. The segment will only actually be destroyed after the last process detaches it (i.e., when the shm_nattch member of the associated structure shmid_ds is zero). The caller must be the owner or creator, or be privileged. If a segment has been marked for destruction, then the (non-standard) SHM_DEST flag of the shm_perm.mode field in the associated data structure retrieved by IPC_STAT will be set.
-----------

So it would seem logical that the "dest" in the status column means that SHM_DEST flag has been set for that memory segment.

Setting it makes the OS automatically clean up the shared memory segment when it is no longer used, even if the process that is supposed to do the cleanup is kill -9'ed or crashes. So the sysadmin won't need to use ipcrm to manually clean up shared memory segments after an application crash.

MK
MK
Pattabhi
Frequent Advisor

Re: understand ipcs command

MK,

Thanks for the information.