shm -- IPC shared memory structures




A shared memory identifier (shmid) is a unique positive integer created by a shmget(S) system call. Each shmid has a segment of memory (referred to as a shared memory segment) and a data structure associated with it. The data structure is referred to as shmid_ds and contains the following members:
   struct  ipc_perm shm_perm;     /* operation permission struct */
   int     shm_segsz;             /* size of segment */
   ushort  shm_cpid;              /* creator pid */
   ushort  shm_lpid;              /* pid of last operation */
   short   shm_nattch;            /* number of current attaches */
   time_t  shm_atime;             /* last attach time */
   time_t  shm_dtime;             /* last detach time */
   time_t  shm_ctime;             /* last change time */
                                  /* Times measured in secs since */
                                  /* 00:00:00 GMT, Jan. 1, 1970 */
shm_perm is an ipc_perm structure that specifies the shared memory operation permission. The structure includes the following members:
   ushort  cuid;                   /* creator user id */
   ushort  cgid;                   /* creator group id */
   ushort  uid;                    /* user id */
   ushort  gid;                    /* group id */
   ushort  mode;                   /* r/w permission */
shm_segsz specifies the size of the shared memory segment. shm_cpid is the process ID of the process that created the shared memory identifier. shm_lpid is the process ID of the last process that performed a shmop(S) operation. shm_nattch is the number of processes that currently have this segment attached. shm_atime is the time of the last shmat operation. shm_dtime is the time of the last shmdt operation, and shm_ctime is the time of the last shmctl(S) operation that changed one of the above structure members.

In the shmop(S) and shmctl(S) system call descriptions, the permission required for an operation is given as ``{token''}, where ``token'' is the type of permission needed. It is interpreted as follows:

00400 Read by user
00200 Write by user
00060 Read, write by group
00006 Read, write by others

 00400   Read by user
 00200   Write by user
 00060   Read, write by group
 00006   Read, write by others

Read and write permissions on a shmid are granted to a process if one or more of the following are true:

Otherwise, the corresponding permissions are denied.

See also

shmctl(S), shmget(S), shmop(S)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005