The kernel maintains a special data structure for each shared memory segment, namely, shmid_ds, which is defined in include/Linux/SHM. h.
As follows:
Struct shmid_ds {
Struct ipc_perm shm_perm;/* operation permission */
Int shm_segsz;/* segment size (in bytes )*/
Time_t shm_atime;/* time when the last process was appended to this segment */
Time_t shm_dtime;/* time when the last process leaves the segment */
Time_t shm_ctime;/* the time when the last Process modified the segment */
Unsigned short shm_cpid;/* Create the PID of this process */
Unsigned short shm_lpid;/* PID of the last process operated on this segment */
Short shm_nattch;/* Number of processes currently appended to this segment */
/* The following is private */
Unsigned short shm_npages;/* segment size (in page )*/
Unsigned long * shm_pages;/* pointer array pointing to frames-> shmmax */
Struct vm_area_struct * attaches;/* description of shared segments */
};