⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ipc.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>IPC</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><blockquote><center><h3><a name = "tag_000_007">&nbsp;</a>Interprocess Communication</h3></center><xref type="2" name="ipc"></xref>The following message passing, semaphore and shared memory servicesform an Interprocess Communication facility.Certain aspects of their operation are common, and are described below.<p><center><table  bordercolor=#000000 border=1 align=center><tr valign=top><th colspan=3 align=center><b>IPC Functions</b><tr valign=top><td align=left><i><a href="msgctl.html">msgctl</i>()</a><td align=left><i><a href="msgget.html">msgget</i>()</a><td align=left><i><a href="msgrcv.html">msgrcv</i>()</a><tr valign=top><td align=left><i><a href="msgsnd.html">msgsnd</i>()</a><td align=left><i><a href="semctl.html">semctl</i>()</a><td align=left><i><a href="semget.html">semget</i>()</a><tr valign=top><td align=left><i><a href="semop.html">semop</i>()</a><td align=left><i><a href="shmat.html">shmat</i>()</a><td align=left><i><a href="shmctl.html">shmctl</i>()</a><tr valign=top><td align=left><i><a href="shmdt.html">shmdt</i>()</a><td align=left><i><a href="shmget.html">shmget</i>()</a><td align=left>&nbsp;</table></center><p>Another Interprocess Communication facility is provided by functionsin the <a href="realtime.html">Realtime Feature Group</a>.<h4><a name = "tag_000_007_001">&nbsp;</a>IPC General Description</h4><xref type="3" name="ipcgen"></xref>Each individual shared memory segment, message queue and semaphore setis identified by a unique positive integer,called respectivelya shared memory identifier,<i>shmid</i>,a semaphore identifier,<i>semid</i>,and a message queue identifier,<i>msqid</i>.The identifiers are returned by calls on<i><a href="shmget.html">shmget()</a></i>,<i><a href="semget.html">semget()</a></i>and<i><a href="msgget.html">msgget()</a></i>,respectively.<p>Associated with each identifier is a data structurewhich contains data related to the operations which may beor may have been performed.See<i><a href="sysshm.h.html">&lt;sys/shm.h&gt;</a></i>,<i><a href="syssem.h.html">&lt;sys/sem.h&gt;</a></i>and<i><a href="sysmsg.h.html">&lt;sys/msg.h&gt;</a></i>for their descriptions.<p>Each of the data structures contains both ownership information and an<b>ipc_perm</b>structure, see<i><a href="sysipc.h.html">&lt;sys/ipc.h&gt;</a></i>,which are used in conjunctionto determine whether or not read/write (read/alter forsemaphores) permissions should be granted to processesusing the IPC facilities.The<i>mode</i>member of the<b>ipc_perm</b>structure acts as a bit field which determines the permissions.<br><p>The values of the bits are given below in octal notation.<p><table  bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>Bit</b><th align=center><b>Meaning</b><tr valign=top><td align=left>0400<td align=left>Read by user<tr valign=top><td align=left>0200<td align=left>Write by user<tr valign=top><td align=left>0040<td align=left>Read by group<tr valign=top><td align=left>0020<td align=left>Write by group<tr valign=top><td align=left>0004<td align=left>Read by others<tr valign=top><td align=left>0002<td align=left>Write by others</table><p>The name of the<b>ipc_perm</b>structure is<i>shm_perm</i>,<i>sem_perm</i>or<i>msg_perm</i>,depending on which service is being used.In each case, read and write/alterpermissions are granted to a process if one or moreof the following are true (<i>xxx</i>is replaced by<i>shm</i>,<i>sem</i>or<i>msg</i>,as appropriate):<ul><p><li>The process has appropriate privileges.<p><li>The effective userIDof the process matches<i>xxx_perm.cuid</i>or<i>xxx_perm.uid</i>in the data structure associated with the IPC identifierand the appropriate bit of the<i>user</i>field in<i>xxx_perm.mode</i>is set.<p><li>The effective userIDof the process does not match<i>xxx_perm.cuid</i>or<i>xxx_perm.uid</i>butthe effective groupIDof the process matches<i>xxx_perm.cgid</i>or<i>xxx_perm.gid</i>in the data structure associated with the IPC identifier,and the appropriate bit of the<i>group</i>field in<i>xxx_perm.mode</i>is set.<p><li>The effective userIDof the process does not match<i>xxx_perm.cuid</i>or<i>xxx_perm.uid</i>andthe effective groupIDof the process does not match<i>xxx_perm.cgid</i>or<i>xxx_perm.gid</i>in the data structure associated with the IPC identifier,but the appropriate bit of the<i>other</i>field in<i>xxx_perm.mode</i>is set.<p></ul><p>Otherwise, the permission is denied.</blockquote><hr size=2 noshade><center><font size=2>UNIX &reg; is a registered Trademark of The Open Group.<br>Copyright &copy; 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -