shm(FP) 6 January 1993 shm(FP) Name shm - IPC shared memory structures Syntax /etc/conf/cf.d/sfsys Description 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 shmidds 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 */ shmperm is an ipcperm structure that specifies the shared memory opera- tion 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 */ shmsegsz specifies the size of the shared memory segment. shmcpid is the process ID of the process that created the shared memory identifier. shmlpid is the process ID of the last process that performed a shmop(S) operation. shmnattch is the number of processes that currently have this segment attached. shmatime is the time of the last shmat operation. shmdtime is the time of the last shmdt operation, and shmctime is the time of the last shmctl(S) operation that changed one of the above struc- ture 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 Read and write permissions on a shmid are granted to a process if one or more of the following are true: + The effective user ID of the process is super user. + The effective user ID of the process matches shmperm.uid or shmperm.cuid in the data structure associated with shmid and the appropriate bit of the ``user'' portion (0600) of shmperm.mode is set. + The effective user ID of the process does not match shmperm.uid or shmperm.cuid and the effective group ID. The process matches shmperm.gid or shmperm.cgid and the appropriate bit of the ``group'' portion (060) of shmperm.mode is set. + The effective user ID of the process does not match shmperm.uid or shmperm.cuid and the effective group ID of the process does not match shmperm.gid or shmperm.cgid and the appropriate bit of the ``other'' portion (06) of shmperm.mode is set. Otherwise, the corresponding permissions are denied. See also shmctl(S), shmget(S), shmop(S)