Quando um novo segmento de memória é criado, as permissões de acesso definidas pelo parâmetro shmflg são copiadas no membro shm_perm da estrutura shmid_ds que define efetivamente o segmento. A estrutura shmid_ds é mostrada a seguir:
struct shmid_ds
{
struct ipc_perm shm_perm; /* operation permissions */
int shm_segsz; /* size of segment (bytes) */
time_t shm_atime; /* last attach time */
time_t shm_dtime; /* last detach time */
time_t shm_ctime; /* last change time */
unsigned short shm_cpid; /* pid of creator */
unsigned short shm_lpid; /* pid of last operator */
short shm_nattch; /* no. of current attaches */
};
Os campos no membro shm_perm são os seguintes:
struct ipc_perm
{
key_t key;
ushort uid; /* owner euid and egid */
ushort gid;
ushort cuid; /* creator euid and egid */
ushort cgid;
ushort mode; /* lower 9 bits of shmflg */
ushort seq; /* sequence number */
};