📄 posix_typed_mem_open.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>posix_typed_mem_open</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="posix_typed_mem_open"></a> <a name="tag_03_481"></a><!-- posix_typed_mem_open --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright © 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_03_481_01"></a>NAME</h4><blockquote>posix_typed_mem_open - open a typed memory object (<b>ADVANCED REALTIME</b>)</blockquote><h4><a name="tag_03_481_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><div class="box"><code><tt><sup>[<a href="javascript:open_code('TYM')">TYM</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> #include <<a href="../basedefs/sys/mman.h.html">sys/mman.h</a>><br><br> int posix_typed_mem_open(const char *</tt><i>name</i><tt>, int</tt> <i>oflag</i><tt>, int</tt> <i>tflag</i><tt>); <img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div><tt><br></tt></blockquote><h4><a name="tag_03_481_03"></a>DESCRIPTION</h4><blockquote><p>The <i>posix_typed_mem_open</i>() function shall establish a connection between the typed memory object specified by the stringpointed to by <i>name</i> and a file descriptor. It shall create an open file description that refers to the typed memory objectand a file descriptor that refers to that open file description. The file descriptor is used by other functions to refer to thattyped memory object. It is unspecified whether the name appears in the file system and is visible to other functions that takepathnames as arguments. The <i>name</i> argument shall conform to the construction rules for a pathname. If <i>name</i> begins withthe slash character, then processes calling <i>posix_typed_mem_open</i>() with the same value of <i>name</i> shall refer to thesame typed memory object. If <i>name</i> does not begin with the slash character, the effect is implementation-defined. Theinterpretation of slash characters other than the leading slash character in <i>name</i> is implementation-defined.</p><p>Each typed memory object supported in a system shall be identified by a name which specifies not only its associated typedmemory pool, but also the path or port by which it is accessed. That is, the same typed memory pool accessed via several differentports shall have several different corresponding names. The binding between names and typed memory objects is established in animplementation-defined manner. Unlike shared memory objects, there is no way within IEEE Std 1003.1-2001 for a program tocreate a typed memory object.</p><p>The value of <i>tflag</i> shall determine how the typed memory object behaves when subsequently mapped by calls to <a href="../functions/mmap.html"><i>mmap</i>()</a>. At most, one of the following flags defined in <a href="../basedefs/sys/mman.h.html"><i><sys/mman.h></i></a> may be specified:</p><dl compact><dt>POSIX_TYPED_MEM_ALLOCATE</dt><dd>Allocate on <a href="../functions/mmap.html"><i>mmap</i>()</a>.</dd><dt>POSIX_TYPED_MEM_ALLOCATE_CONTIG</dt><dd>Allocate contiguously on <a href="../functions/mmap.html"><i>mmap</i>()</a>.</dd><dt>POSIX_TYPED_MEM_MAP_ALLOCATABLE</dt><dd>Map on <a href="../functions/mmap.html"><i>mmap</i>()</a>, without affecting allocatability.</dd></dl><p>If <i>tflag</i> has the flag POSIX_TYPED_MEM_ALLOCATE specified, any subsequent call to <a href="../functions/mmap.html"><i>mmap</i>()</a> using the returned file descriptor shall result in allocation and mapping of typedmemory from the specified typed memory pool. The allocated memory may be a contiguous previously unallocated area of the typedmemory pool or several non-contiguous previously unallocated areas (mapped to a contiguous portion of the process address space).If <i>tflag</i> has the flag POSIX_TYPED_MEM_ALLOCATE_CONTIG specified, any subsequent call to <a href="../functions/mmap.html"><i>mmap</i>()</a> using the returned file descriptor shall result in allocation and mapping of a singlecontiguous previously unallocated area of the typed memory pool (also mapped to a contiguous portion of the process address space).If <i>tflag</i> has none of the flags POSIX_TYPED_MEM_ALLOCATE or POSIX_TYPED_MEM_ALLOCATE_CONTIG specified, any subsequent call to<a href="../functions/mmap.html"><i>mmap</i>()</a> using the returned file descriptor shall map an application-chosen area from thespecified typed memory pool such that this mapped area becomes unavailable for allocation until unmapped by all processes. If<i>tflag</i> has the flag POSIX_TYPED_MEM_MAP_ALLOCATABLE specified, any subsequent call to <a href="../functions/mmap.html"><i>mmap</i>()</a> using the returned file descriptor shall map an application-chosen area from thespecified typed memory pool without an effect on the availability of that area for allocation; that is, mapping such an objectleaves each byte of the mapped area unallocated if it was unallocated prior to the mapping or allocated if it was allocated priorto the mapping. The appropriate privilege to specify the POSIX_TYPED_MEM_MAP_ALLOCATABLE flag is implementation-defined.</p><p>If successful, <i>posix_typed_mem_open</i>() shall return a file descriptor for the typed memory object that is the lowestnumbered file descriptor not currently open for that process. The open file description is new, and therefore the file descriptorshall not share it with any other processes. It is unspecified whether the file offset is set. The FD_CLOEXEC file descriptor flagassociated with the new file descriptor shall be cleared.</p><p>The behavior of <a href="../functions/msync.html"><i>msync</i>()</a>, <a href="../functions/ftruncate.html"><i>ftruncate</i>()</a>, and all file operations other than <a href="../functions/mmap.html"><i>mmap</i>()</a>, <a href="../functions/posix_mem_offset.html"><i>posix_mem_offset</i>()</a>, <a href="../functions/posix_typed_mem_get_info.html"><i>posix_typed_mem_get_info</i>()</a>, <a href="../functions/fstat.html"><i>fstat</i>()</a>, <a href="../functions/dup.html"><i>dup</i>()</a>, <a href="../functions/dup2.html"><i>dup2</i>()</a>, and <a href="../functions/close.html"><i>close</i>()</a>, is unspecified when passed afile descriptor connected to a typed memory object by this function.</p><p>The file status flags of the open file description shall be set according to the value of <i>oflag</i>. Applications shallspecify exactly one of the three access mode values described below and defined in the <a href="../basedefs/fcntl.h.html"><i><fcntl.h></i></a> header, as the value of <i>oflag</i>.</p><dl compact><dt>O_RDONLY</dt><dd>Open for read access only.</dd><dt>O_WRONLY</dt><dd>Open for write access only.</dd><dt>O_RDWR</dt><dd>Open for read or write access.</dd></dl></blockquote><h4><a name="tag_03_481_04"></a>RETURN VALUE</h4><blockquote><p>Upon successful completion, the <i>posix_typed_mem_open</i>() function shall return a non-negative integer representing thelowest numbered unused file descriptor. Otherwise, it shall return -1 and set <i>errno</i> to indicate the error.</p></blockquote><h4><a name="tag_03_481_05"></a>ERRORS</h4><blockquote><p>The <i>posix_typed_mem_open</i>() function shall fail if:</p><dl compact><dt>[EACCES]</dt><dd>The typed memory object exists and the permissions specified by <i>oflag</i> are denied.</dd><dt>[EINTR]</dt><dd>The <i>posix_typed_mem_open</i>() operation was interrupted by a signal.</dd><dt>[EINVAL]</dt><dd>The flags specified in <i>tflag</i> are invalid (more than one of POSIX_TYPED_MEM_ALLOCATE, POSIX_TYPED_MEM_ALLOCATE_CONTIG, orPOSIX_TYPED_MEM_MAP_ALLOCATABLE is specified).</dd><dt>[EMFILE]</dt><dd>Too many file descriptors are currently in use by this process.</dd><dt>[ENAMETOOLONG]</dt><dd>The length of the <i>name</i> argument exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}.</dd><dt>[ENFILE]</dt><dd>Too many file descriptors are currently open in the system.</dd><dt>[ENOENT]</dt><dd>The named typed memory object does not exist.</dd><dt>[EPERM]</dt><dd>The caller lacks the appropriate privilege to specify the flag POSIX_TYPED_MEM_MAP_ALLOCATABLE in argument <i>tflag</i>.</dd></dl></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_03_481_06"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_481_07"></a>APPLICATION USAGE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_481_08"></a>RATIONALE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_481_09"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_481_10"></a>SEE ALSO</h4><blockquote><p><a href="close.html"><i>close</i>()</a> , <a href="dup.html"><i>dup</i>()</a> , <a href="exec.html"><i><a href="../functions/exec.html">exec</a></i>()</a> , <a href="fcntl.html"><i>fcntl</i>()</a> , <a href="fstat.html"><i>fstat</i>()</a> ,<a href="ftruncate.html"><i>ftruncate</i>()</a> , <a href="mmap.html"><i>mmap</i>()</a> , <a href="msync.html"><i>msync</i>()</a> ,<a href="posix_mem_offset.html"><i>posix_mem_offset</i>()</a> , <a href="posix_typed_mem_get_info.html"><i>posix_typed_mem_get_info</i>()</a> , <a href="umask.html"><i>umask</i>()</a> , the BaseDefinitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/fcntl.h.html"><i><fcntl.h></i></a>, <a href="../basedefs/sys/mman.h.html"><i><sys/mman.h></i></a></p></blockquote><h4><a name="tag_03_481_11"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 6. Derived from IEEE Std 1003.1j-2000.</p></blockquote><div class="box"><em>End of informative text.</em></div><hr><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX ® is a registered Trademark of The Open Group.<br>POSIX ® 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 + -