*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> shmid_ds (4)              



NAME    [Toc]    [Back]

       shmid_ds - Defines a shared memory region

SYNOPSIS    [Toc]    [Back]

       #include <sys/shm.h>

       struct shmid_ds(
               struct ipc_perm shm_perm,
               int shm_segsz,
               u_short shm_lpid,
               u_short shm_cpid,
               u_short shm_nattch,
               time_t shm_atime,
               time_t shm_dtime,
               time_t shm_ctime );

DESCRIPTION    [Toc]    [Back]

       The  shmid_ds  structure  defines  a  shared memory region
       associated with a shared memory region ID.  There  is  one
       shared  memory  region  per  ID.  Collectively, the shared
       memory regions are maintained in a  shared  memory  table,
       with  the shared memory region IDs identifying the entries
       in the table.

       The IPC permissions for  the  shared  memory  regions  are
       implemented in a separate, but associated, ipc_perm structure.

       A shared memory  region  is  created  indirectly  via  the
       shmget()  call.  If shmget() is called with a non-existent
       shared memory  region  ID,  the  kernel  allocates  a  new
       shmid_ds  structure,  initializes  it,  and returns the ID
       that is to be associated with the region.

       The kernel allocates actual memory of shm_segsz bytes only
       when  a  process  attaches  a region to its address space.
       Attached regions  are  maintained  in  a  separate  region
       table.   The  entries  in the shared memory table point to
       the associated attached regions in the region table.   The
       same  shared memory region can be attached multiple times,
       by the same or different processes.   Each  attachment  of
       the region creates a new entry in the region table.

       After  a  process  attaches  a  shared  memory region, the
       region becomes  part  of  the  process's  virtual  address
       space.   Processes  access  shared memory regions by using
       the same machine instructions used to access  any  virtual

       The following sections describe the fields in the shmid_ds
       structure and show the associated ipc_perm structure.

FIELDS    [Toc]    [Back]

       The ipc_perm structure that defines permissions for shared
       memory  operations.  The size of the shared memory region,
       in bytes.  The process ID of the process that created  the
       shared  memory region ID.  The process ID of the last process
 that performed a shmat() or shmdt() operation on  the
       shared  memory  region.  The number of processes that currently
 have this region attached.  The time  of  the  last
       shmat()  operation.   The  time of the last shmdt() operation.
  The  time  of  the  last  shmctl()  operation  that
       changed  a  member of the ipc_perm structure designated by
       the shm_perm field.


       The shm_perm  field  identifies  the  associated  ipc_perm
       structure  that  defines the permissions for operations on
       the shared memory region.  The  ipc_perm  structure  (from
       the sys/ipc.h header file) is as follows:

       struct ipc_perm {
               ushort      uid;          /*   owner's   user   id
               ushort     gid;          /*   owner's   group   id
               ushort      cuid;         /*   creator's  user  id
               ushort     cgid;        /*  creator's   group   id
               ushort        mode;          /*    access    modes
               ushort    seq;        /* slot usage sequence  number
               key_t             key;               /*        key
       */ };

       The mode field is a nine-bit field that contains the  permissions
  for  shared  memory operations.  The first three
       bits identify owner permissions;  the  second  three  bits
       identify  group permissions; and the last three bits identify
 other permissions.  In  each  group,  the  first  bit
       indicates  read permission; the second bit indicates write
       permission; and the third bit is not used.

SEE ALSO    [Toc]    [Back]

       Functions: shmat(2), shmdt(2), shmctl(2), shmget(2)

[ Back ]
 Similar pages
Name OS Title
shmat Tru64 Attach a shared memory region
shmdt Tru64 Detach a shared memory region
shmget Tru64 Return (and possibly create) the ID for a shared memory region
msem_init Tru64 Initialize a semaphore in a mapped file or shared memory region
nshmget Tru64 Returns (or creates) the ID for a shared memory region (libnuma library)
shm_open FreeBSD open or create a shared memory object shm_unlink -- remove a shared memory object
mvalid Tru64 Check memory region for validity
mlock Tru64 Locks or unlocks a specified region in memory (P1003.1b)
mprotect Linux control allowable accesses to a region of memory
munlock Tru64 Locks or unlocks a specified region in memory (P1003.1b)
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service