Files
oldlinux-files/Ref-docs/POSIX/susv3/functions/posix_mem_offset.html
2024-02-19 00:21:47 -05:00

140 lines
5.5 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>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-2001<br>
Copyright &copy; 2001 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 &lt;<a href="../basedefs/sys/mman.h.html">sys/mman.h</a>&gt;<br>
<br>
int posix_mem_offset(const void *restrict</tt> <i>addr</i><tt>, size_t</tt> <i>len</i><tt>,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; off_t *restrict</tt> <i>off</i><tt>, size_t *restrict</tt> <i>contig_len</i><tt>,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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 the
variable pointed to by <i>fildes</i>, the descriptor used (via <a href="../functions/mmap.html"><i>mmap</i>()</a>) to establish the
mapping 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 the
offset for; upon return, the value pointed to by <i>contig_len</i> shall equal either <i>len</i>, or the length of the largest
contiguous block of the memory object that is currently mapped to the calling process starting at <i>addr</i>, whichever is
smaller.</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> values
obtained by calling <i>posix_mem_offset</i>() are used in a call to <a href="../functions/mmap.html"><i>mmap</i>()</a> with a file
descriptor that refers to the same memory pool as <i>fildes</i> (either through the same port or through a different port), and
that was opened with neither the POSIX_TYPED_MEM_ALLOCATE nor the POSIX_TYPED_MEM_ALLOCATE_CONTIG flag, the typed memory area that
is 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 is
implementation-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 status
value 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 Base
Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/sys/mman.h.html"><i>&lt;sys/mman.h&gt;</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&nbsp;Std&nbsp;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 &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>