📄 posix_mem_offset.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_mem_offset</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="posix_mem_offset"></a> <a name="tag_03_424"></a><!-- posix_mem_offset --> <!--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_424_01"></a>NAME</h4><blockquote>posix_mem_offset - find offset and length of a mapped typed memory block (<b>ADVANCED REALTIME</b>)</blockquote><h4><a name="tag_03_424_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_mem_offset(const void *restrict</tt> <i>addr</i><tt>, size_t</tt> <i>len</i><tt>,<br> off_t *restrict</tt> <i>off</i><tt>, size_t *restrict</tt> <i>contig_len</i><tt>,<br> int *restrict</tt> <i>fildes</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_424_03"></a>DESCRIPTION</h4><blockquote><p>The <i>posix_mem_offset</i>() function shall return in the variable pointed to by <i>off</i> a value that identifies the offset(or location), within a memory object, of the memory block currently mapped at <i>addr</i>. The function shall return in thevariable pointed to by <i>fildes</i>, the descriptor used (via <a href="../functions/mmap.html"><i>mmap</i>()</a>) to establish themapping which contains <i>addr</i>. If that descriptor was closed since the mapping was established, the returned value of<i>fildes</i> shall be -1. The <i>len</i> argument specifies the length of the block of the memory object the user wishes theoffset for; upon return, the value pointed to by <i>contig_len</i> shall equal either <i>len</i>, or the length of the largestcontiguous block of the memory object that is currently mapped to the calling process starting at <i>addr</i>, whichever issmaller.</p><p>If the memory object mapped at <i>addr</i> is a typed memory object, then if the <i>off</i> and <i>contig_len</i> valuesobtained by calling <i>posix_mem_offset</i>() are used in a call to <a href="../functions/mmap.html"><i>mmap</i>()</a> with a filedescriptor that refers to the same memory pool as <i>fildes</i> (either through the same port or through a different port), andthat was opened with neither the POSIX_TYPED_MEM_ALLOCATE nor the POSIX_TYPED_MEM_ALLOCATE_CONTIG flag, the typed memory area thatis mapped shall be exactly the same area that was mapped at <i>addr</i> in the address space of the process that called<i>posix_mem_offset</i>().</p><p>If the memory object specified by <i>fildes</i> is not a typed memory object, then the behavior of this function isimplementation-defined.</p></blockquote><h4><a name="tag_03_424_04"></a>RETURN VALUE</h4><blockquote><p>Upon successful completion, the <i>posix_mem_offset</i>() function shall return zero; otherwise, the corresponding error statusvalue shall be returned.</p></blockquote><h4><a name="tag_03_424_05"></a>ERRORS</h4><blockquote><p>The <i>posix_mem_offset</i>() function shall fail if:</p><dl compact><dt>[EACCES]</dt><dd>The process has not mapped a memory object supported by this function at the given address <i>addr</i>.</dd></dl><p>This function shall not return an error code of [EINTR].</p></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_03_424_06"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_424_07"></a>APPLICATION USAGE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_424_08"></a>RATIONALE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_424_09"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_424_10"></a>SEE ALSO</h4><blockquote><p><a href="mmap.html"><i>mmap</i>()</a> , <a href="posix_typed_mem_open.html"><i>posix_typed_mem_open</i>()</a> , the BaseDefinitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/sys/mman.h.html"><i><sys/mman.h></i></a></p></blockquote><h4><a name="tag_03_424_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 + -