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

📄 xsh_chap02_07.html

📁 IEEE 1003.1-2003, Single Unix Specification v3
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy, see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 --><!-- Copyright (c) 2001-2003 The Open Group, All Rights Reserved --><title>System Interfaces Chapter 2</title></head><body><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1-2001</font></center><hr size="2" noshade><h3><a name="tag_02_07"></a>XSI Interprocess Communication</h3><p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">This section describes extensions to support interprocess communication. This functionality is dependent on support of the XSIextension (and the rest of this section is not further marked for this option). <img src="../images/opt-end.gif" alt="[Option End]"border="0"></p><p>The following message passing, semaphore, and shared memory services form an XSI interprocess communication facility. Certainaspects of their operation are common, and are defined as follows.</p><center><table border="1" cellpadding="3" align="center"><tr valign="top"><th colspan="3" align="center"><p class="tent"><b>IPC Functions</b></p></th></tr><tr valign="top"><td align="left"><p class="tent"><br><a href="../functions/msgctl.html"><i>msgctl</i>()</a><br><a href="../functions/msgget.html"><i>msgget</i>()</a><br><a href="../functions/msgrcv.html"><i>msgrcv</i>()</a><br><a href="../functions/msgsnd.html"><i>msgsnd</i>()</a><br>&nbsp;</p></td><td align="left"><p class="tent"><br><a href="../functions/semctl.html"><i>semctl</i>()</a><br><a href="../functions/semget.html"><i>semget</i>()</a><br><a href="../functions/semop.html"><i>semop</i>()</a><br><a href="../functions/shmat.html"><i>shmat</i>()</a><br>&nbsp;</p></td><td align="left"><p class="tent"><br><a href="../functions/shmctl.html"><i>shmctl</i>()</a><br><a href="../functions/shmdt.html"><i>shmdt</i>()</a><br><a href="../functions/shmget.html"><i>shmget</i>()</a><br>&nbsp;</p></td></tr></table></center><p>Another interprocess communication facility is provided by functions in the Realtime Option Group; see <a href="xsh_chap02_08.html#tag_02_08"><i>Realtime</i></a> .</p><h4><a name="tag_02_07_01"></a>IPC General Description</h4><p>Each individual shared memory segment, message queue, and semaphore set shall be identified by a unique positive integer,called, respectively, a shared memory identifier, <i>shmid</i>, a semaphore identifier, <i>semid</i>, and a message queueidentifier, <i>msqid</i>. The identifiers shall be returned by calls to <a href="../functions/shmget.html"><i>shmget</i>()</a>, <ahref="../functions/semget.html"><i>semget</i>()</a>, and <a href="../functions/msgget.html"><i>msgget</i>()</a>, respectively.</p><p>Associated with each identifier is a data structure which contains data related to the operations which may be or may have beenperformed; see the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/sys/shm.h.html"><i>&lt;sys/shm.h&gt;</i></a>, <a href="../basedefs/sys/sem.h.html"><i>&lt;sys/sem.h&gt;</i></a>, and<a href="../basedefs/sys/msg.h.html"><i>&lt;sys/msg.h&gt;</i></a> for their descriptions.</p><p>Each of the data structures contains both ownership information and an <b>ipc_perm</b> structure (see the Base Definitionsvolume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/sys/ipc.h.html"><i>&lt;sys/ipc.h&gt;</i></a>) which are used inconjunction to determine whether or not read/write (read/alter for semaphores) permissions should be granted to processes using theIPC facilities. The <i>mode</i> member of the <b>ipc_perm</b> structure acts as a bit field which determines the permissions.</p><p>The values of the bits are given below in octal notation.</p><center><table border="1" cellpadding="3" align="center"><tr valign="top"><th align="center"><p class="tent"><b>Bit</b></p></th><th align="center"><p class="tent"><b>Meaning</b></p></th></tr><tr valign="top"><td align="left"><p class="tent">0400</p></td><td align="left"><p class="tent">Read by user.</p></td></tr><tr valign="top"><td align="left"><p class="tent">0200</p></td><td align="left"><p class="tent">Write by user.</p></td></tr><tr valign="top"><td align="left"><p class="tent">0040</p></td><td align="left"><p class="tent">Read by group.</p></td></tr><tr valign="top"><td align="left"><p class="tent">0020</p></td><td align="left"><p class="tent">Write by group.</p></td></tr><tr valign="top"><td align="left"><p class="tent">0004</p></td><td align="left"><p class="tent">Read by others.</p></td></tr><tr valign="top"><td align="left"><p class="tent">0002</p></td><td align="left"><p class="tent">Write by others.</p></td></tr></table></center><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 isbeing used. In each case, read and write/alter permissions shall be granted to a process if one or more of the following are true (<tt>"xxx"</tt> is replaced by <i>shm</i>, <i>sem</i>, or <i>msg</i>, as appropriate):</p><ul><li><p>The process has appropriate privileges.</p></li><li><p>The effective user ID of the process matches <i>xxx_perm.cuid</i> or <i>xxx_perm.uid</i> in the data structure associated withthe IPC identifier, and the appropriate bit of the <i>user</i> field in <i>xxx_perm.mode</i> is set.</p></li><li><p>The effective user ID of the process does not match <i>xxx_perm.cuid</i> or <i>xxx_perm.uid</i> but the effective group ID ofthe process matches <i>xxx_perm.cgid</i> or <i>xxx_perm.gid</i> in the data structure associated with the IPC identifier, and theappropriate bit of the <i>group</i> field in <i>xxx_perm.mode</i> is set.</p></li><li><p>The effective user ID of the process does not match <i>xxx_perm.cuid</i> or <i>xxx_perm.uid</i> and the effective group ID ofthe 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></li></ul><p>Otherwise, the permission shall be denied.</p><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX &reg; is a registered Trademark of The Open Group.<br>POSIX &reg; is a registered Trademark of The IEEE.<br>[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>]</font></center><!--footer end--><hr size="2" noshade></body></html>

⌨️ 快捷键说明

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