Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
ipc(5)
Edit
PageHistory
Diff
Info
LikePages
IPC !!!IPC NAME SYNOPSIS DESCRIPTION SEE ALSO ---- !!NAME ipc - System V interprocess communication mechanisms !!SYNOPSIS __# include __ !!DESCRIPTION The manual page refers to the Linux implementation of the System V interprocess communication mechanisms: message queues, semaphore sets and shared memory segments. In the following, the word __resource__ means an instantiation of one among such mechanisms. __Resource Access Permissions__ For each resource the system uses a common structure of type __struct ipc_perm__ to store information needed in determining permissions to perform an ipc operation. The __ipc_perm__ structure, defined by the '''' system header file, includes the following members: __ushort cuid;__ /* creator user id */__ ushort cgid;__ /* creator group id */__ ushort uid;__ /* owner user id */__ ushort gid;__ /* owner group id */__ ushort mode;__ /* r/w permissions */ The __mode__ member of the __ipc_perm__ structure defines, with its lower 9 bits, the access permissions to the resource for a process executing an ipc system call. The permissions are interpreted as follows: 0400 Read by user. 0200 Write by user. 0040 Read by group. 0020 Write by group. 0004 Read by others. 0002 Write by others. Bits 0100, 0010 and 0001 (the execute bits) are unused by the system. Furthermore The same system header file defines also the following symbolic constants: __IPC_CREAT__ Create entry if key doesn't exists. __IPC_EXCL__ Fail if key exists. __IPC_NOWAIT__ Error if request must wait. __IPC_PRIVATE__ Private key. __IPC_RMID__ Remove resource. __IPC_SET__ Set resource options. __IPC_STAT__ Get resource options. Note that __IPC_PRIVATE__ is a __key_t__ type, while all the others symbolic constants are flag fields or-able into an __int__ type variable. __Message Queues__ A message queue is uniquely identified by a positive integer (its ''msqid'') and has an associated data structure of type __struct msquid_ds__, defined in '''', containing the following members: __struct ipc_perm msg_perm; ushort msg_qnum;__ /* no of messages on queue */__ ushort msg_qbytes;__ /* bytes max on a queue */__ ushort msg_lspid;__ /* pid of last msgsnd call */__ ushort msg_lrpid;__ /* pid of last msgrcv call */__ time_t msg_stime;__ /* last msgsnd time */__ time_t msg_rtime;__ /* last msgrcv time */__ time_t msg_ctime;__ /* last change time */ __msg_perm__ __ipc_perm__ structure that specifies the access permissions on the message queue. __msg_qnum__ Number of messages currently on the message queue. __msg_qbytes__ Maximum number of bytes of message text allowed on the message queue. __msg_lspid__ ID of the process that performed the last __msgsnd__ system call. __msg_lrpid__ ID of the process that performed the last __msgrcv__ system call. __msg_stime__ Time of the last __msgsnd__ system call. __msg_rtime__ Time of the last __msgcv__ system call. __msg_ctime__ Time of the last system call that changed a member of the __msqid_ds__ structure. __Semaphore Sets__ A semaphore set is uniquely identified by a positive integer (its ''semid'') and has an associated data structure of type __struct semid_ds__, defined in '''', containing the following members: __struct ipc_perm sem_perm; time_t sem_otime;__ /* last operation time */__ time_t sem_ctime;__ /* last change time */__ ushort sem_nsems;__ /* count of sems in set */ __sem_perm__ __ipc_perm__ structure that specifies the access permissions on the semaphore set. __sem_otime__ Time of last __semop__ system call. __sem_ctime__ Time of last __semctl__ system call that changed a member of the above structure or of one semaphore belonging to the set. __sem_nsems__ Number of semaphores in the set. Each semaphore of the set is referenced by a non-negative integer ranging from __0__ to __sem_nsems-1__. A semaphore is a data structure of type __struct sem__ containing the following members: __ushort semval;__ /* semaphore value */__ short sempid;__ /* pid for last operation */__ ushort semncnt;__ /* no. of awaiting semval to increase */__ ushort semzcnt;__ /* no. of awaiting semval = 0 */ __semval__ Semaphore value: a non-negative integer. __sempid__ ID of the last process that performed a semaphore operation on this semaphore. __semncnt__ Number of processes suspended awaiting for __semval__ to increase. __semznt__ Number of processes suspended awaiting for __semval__ to become zero. __Shared Memory Segments__ A shared memory segment is uniquely identified by a positive integer (its ''shmid'') and has an associated data structure of type __struct shmid_ds__, defined in '''', containing the following members: __struct ipc_perm shm_perm; int shm_segsz;__ /* size of segment */__ ushort shm_cpid;__ /* pid of creator */__ ushort shm_lpid;__ /* pid, last operation */__ short shm_nattch;__ /* no. of current attaches */__ time_t shm_atime;__ /* time of last attach */__ time_t shm_dtime;__ /* time of last detach */__ time_t shm_ctime;__ /* time of last change */ __shm_perm__ __ipc_perm__ structure that specifies the access permissions on the shared memory segment. __shm_segsz__ Size in bytes of the shared memory segment. __shm_cpid__ ID of the process that created the shared memory segment. __shm_lpid__ ID of the last process that executed a __shmat__ or __shmdt__ system call. __shm_nattch__ Number of current alive attaches for this shared memory segment. __shm_atime__ Time of the last __shmat__ system call. __shm_dtime__ Time of the last __shmdt__ system call. __shm_ctime__ Time of the last __shmctl__ system call that changed __shmid_ds__. !!SEE ALSO ftok(3), msgctl(2), msgget(2), msgrcv(2), msgsnd(2), semctl(2), semget(2), semop(2), shmat(2), shmctl(2), shmget(2), shmdt(2) ----
14 pages link to
ipc(5)
:
Man5i
ftok(3)
msgrcv(2)
msgsnd(2)
semget(2)
semop(2)
shmat(2)
shmdt(2)
shmop(2)
shmget(2)
msgctl(2)
msgget(2)
msgop(2)
semctl(2)
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.