193 lines
6.7 KiB
HTML
193 lines
6.7 KiB
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 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 XSI
|
|
extension (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. Certain
|
|
aspects 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>
|
|
</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>
|
|
</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>
|
|
</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 queue
|
|
identifier, <i>msqid</i>. The identifiers shall be returned by calls to <a href="../functions/shmget.html"><i>shmget</i>()</a>, <a
|
|
href="../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 been
|
|
performed; see the Base Definitions volume of IEEE Std 1003.1-2001, <a href=
|
|
"../basedefs/sys/shm.h.html"><i><sys/shm.h></i></a>, <a href="../basedefs/sys/sem.h.html"><i><sys/sem.h></i></a>, and
|
|
<a href="../basedefs/sys/msg.h.html"><i><sys/msg.h></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 Definitions
|
|
volume of IEEE Std 1003.1-2001, <a href="../basedefs/sys/ipc.h.html"><i><sys/ipc.h></i></a>) which are used in
|
|
conjunction to determine whether or not read/write (read/alter for semaphores) permissions should be granted to processes using the
|
|
IPC 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 is
|
|
being 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 with
|
|
the 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 of
|
|
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>
|
|
|
|
<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 of
|
|
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>
|
|
</li>
|
|
</ul>
|
|
|
|
<p>Otherwise, the permission shall be denied.</p>
|
|
|
|
<hr size="2" noshade>
|
|
<center><font size="2">UNIX ® is a registered Trademark of The Open Group.<br>
|
|
POSIX ® is a registered Trademark of The IEEE.<br>
|
|
</font> [ <a href="../mindex.html">Main Index</a>]</center>
|
|
|
|
<hr size="2" noshade>
|
|
</body>
|
|
</html>
|
|
|