[next] [tail] [up]

### 10.1 Types, Constants and variables :

#### Variables

     Var
       IPCerror : longint;

The IPCerror variable is used to report errors, by all calls.

#### Constants

Many constants here are provided for completeness only, and should under normal circumstances not be used by the programmer.

     Const
       IPC_CREAT  =  1 shl 9;  { create if key is nonexistent }
       IPC_EXCL   =  2 shl 9;  { fail if key exists }
       IPC_NOWAIT =  4 shl 9;  { return error on wait }

These constants are used in the various xxxget calls.

       IPC_RMID = 0;     { remove resource }
       IPC_SET  = 1;     { set ipc_perm options }
       IPC_STAT = 2;     { get ipc_perm options }
       IPC_INFO = 3;     { see ipcs }

These constants can be passed to the various xxxctl calls.

     const
       MSG_NOERROR = 1 shl 12;
       MSG_EXCEPT  = 2 shl 12;
       MSGMNI = 128;
       MSGMAX = 4056;
       MSGMNB = 16384;

These constants are used in the messaging system, they are not for use by the programmer.

     const
       SEM_UNDO = $1000;
       GETPID = 11;
       GETVAL = 12;
       GETALL = 13;
       GETNCNT = 14;
       GETZCNT = 15;
       SETVAL = 16;
       SETALL = 17;

These constants call be specified in the semop (271) call.

       SEMMNI = 128;
       SEMMSL = 32;
       SEMMNS = (SEMMNI * SEMMSL);
       SEMOPM = 32;
       SEMVMX = 32767;

These constanst are used internally by the semaphore system, they should not be used by the programmer.

     const
       SHM_R      = 4 shl 6;
       SHM_W      = 2 shl 6;
       SHM_RDONLY = 1 shl 12;
       SHM_RND    = 2 shl 12;
       SHM_REMAP  = 4 shl 12;
       SHM_LOCK   = 11;
       SHM_UNLOCK = 12;

These constants are used in the shmctl (279) call.

#### Types

The following two types are provided because they are needed. One they they should be defined in the system unit, however.

     Type
       PULong = ^Cardinal;
       PWord  = ^Word;

     Type
        TKey   = Longint;

TKey is the type returned by the ftok (266) key generating function.

     type
       PIPC_Perm = ^TIPC_Perm;
       TIPC_Perm = record
         key : TKey;
         uid,
         gid,
         cuid,
         cgid,
         mode,
         seq : Word;
       end;

The TIPC_Perm structure is used in all IPC systems to specify the permissions.

     Type
       PSHMid_DS = ^TSHMid_ds;
       TSHMid_ds = record
         shm_perm  : TIPC_Perm;
         shm_segsz : longint;
         shm_atime : longint;
         shm_dtime : longint;
         shm_ctime : longint;
         shm_cpid  : word;
         shm_lpid  : word;
         shm_nattch : integer;
         shm_npages : word;
         shm_pages  : Pointer;
         attaches   : pointer;
       end;

The TSHMid_ds strucure is used in the shmctl (279) call to set or retrieve settings concerning shared memory.

     type
       PSHMinfo = ^TSHMinfo;
       TSHMinfo = record
         shmmax : longint;
         shmmin : longint;
         shmmni : longint;
         shmseg : longint;
         shmall : longint;
       end;

The TSHMinfo record is used by the shared memory system, and should not be accessed by the programer directly.

     type
       PMSG = ^TMSG;
       TMSG = record
         msg_next  : PMSG;
         msg_type  : Longint;
         msg_spot  : PChar;
         msg_stime : Longint;
         msg_ts    : Integer;
       end;

The TMSG record is used in the handling of message queues. There should be few cases where the programmer needs to access this data.

     type
       PMSQid_ds = ^TMSQid_ds;
       TMSQid_ds = record
         msg_perm   : TIPC_perm;
         msg_first  : PMsg;
         msg_last   : PMsg;
         msg_stime  : Longint;
         msg_rtime  : Longint;
         msg_ctime  : Longint;
         wwait      : Pointer;
         rwait      : pointer;
         msg_cbytes : word;
         msg_qnum   : word;
         msg_qbytes : word;
         msg_lspid  : word;
         msg_lrpid  : word;
       end;

The TMSQid_ds record is returned by the msgctl (268) call, and contains all data about a message queue.

       PMSGbuf = ^TMSGbuf;
       TMSGbuf = record
         mtype : longint;
         mtext : array[0..0] of char;
       end;

The TMSGbuf record is a record containing the data of a record. you should never use this record directly, instead you should make your own record that follows the structure of the TMSGbuf record, but that has a size that is big enough to accomodate your messages. The mtype field should always be present, and should always be filled.

     Type
       PMSGinfo = ^TMSGinfo;
       TMSGinfo = record
         msgpool : Longint;
         msgmap  : Longint;
         msgmax  : Longint;
         msgmnb  : Longint;
         msgmni  : Longint;
         msgssz  : Longint;
         msgtql  : Longint;
         msgseg  : Word;
       end;

The TMSGinfo record is used internally by the message queue system, and should not be used by the programmer directly.

     Type
       PSEMid_ds = ^PSEMid_ds;
       TSEMid_ds = record
         sem_perm : tipc_perm;
         sem_otime : longint;
         sem_ctime : longint;
         sem_base         : pointer;
         sem_pending      : pointer;
         sem_pending_last : pointer;
         undo             : pointer;
         sem_nsems : word;
       end;

The TSEMid_ds structure is returned by the semctl (272) call, and contains all data concerning a semahore.

     Type
       PSEMbuf = ^TSEMbuf;
       TSEMbuf = record
         sem_num : word;
         sem_op  : integer;
         sem_flg : integer;
       end;

The TSEMbuf record us use in the semop (271) call, and is used to specify which operations you want to do.

     Type
       PSEMinfo = ^TSEMinfo;
       TSEMinfo = record
         semmap : longint;
         semmni : longint;
         semmns : longint;
         semmnu : longint;
         semmsl : longint;
         semopm : longint;
         semume : longint;
         semusz : longint;
         semvmx : longint;
         semaem : longint;
       end;

The TSEMinfo record is used internally by the semaphore system, and should not be used directly.

     Type
       PSEMun = ^TSEMun;
       TSEMun = record
        case longint of
           0 : ( val : longint );
           1 : ( buf : PSEMid_ds );
           2 : ( arr : PWord );
           3 : ( padbuf : PSeminfo );
           4 : ( padpad : pointer );
        end;

The TSEMun variant record (actually a C union) is used in the semctl (272) call.

[next] [front] [up]