.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved .TH "POSIX_MEM_OFFSET" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual" .\" posix_mem_offset .SH NAME posix_mem_offset \- find offset and length of a mapped typed memory block (\fBADVANCED REALTIME\fP) .SH SYNOPSIS .LP \fB#include .br .sp int posix_mem_offset(const void *restrict\fP \fIaddr\fP\fB, size_t\fP \fIlen\fP\fB, .br \ \ \ \ \ \ off_t *restrict\fP \fIoff\fP\fB, size_t *restrict\fP \fIcontig_len\fP\fB, .br \ \ \ \ \ \ int *restrict\fP \fIfildes\fP\fB); \fP \fB .br \fP .SH DESCRIPTION .LP The \fIposix_mem_offset\fP() function shall return in the variable pointed to by \fIoff\fP a value that identifies the offset (or location), within a memory object, of the memory block currently mapped at \fIaddr\fP. The function shall return in the variable pointed to by \fIfildes\fP, the descriptor used (via \fImmap\fP()) to establish the mapping which contains \fIaddr\fP. If that descriptor was closed since the mapping was established, the returned value of \fIfildes\fP shall be -1. The \fIlen\fP argument specifies the length of the block of the memory object the user wishes the offset for; upon return, the value pointed to by \fIcontig_len\fP shall equal either \fIlen\fP, or the length of the largest contiguous block of the memory object that is currently mapped to the calling process starting at \fIaddr\fP, whichever is smaller. .LP If the memory object mapped at \fIaddr\fP is a typed memory object, then if the \fIoff\fP and \fIcontig_len\fP values obtained by calling \fIposix_mem_offset\fP() are used in a call to \fImmap\fP() with a file descriptor that refers to the same memory pool as \fIfildes\fP (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 \fIaddr\fP in the address space of the process that called \fIposix_mem_offset\fP(). .LP If the memory object specified by \fIfildes\fP is not a typed memory object, then the behavior of this function is implementation-defined. .SH RETURN VALUE .LP Upon successful completion, the \fIposix_mem_offset\fP() function shall return zero; otherwise, the corresponding error status value shall be returned. .SH ERRORS .LP The \fIposix_mem_offset\fP() function shall fail if: .TP 7 .B EACCES The process has not mapped a memory object supported by this function at the given address \fIaddr\fP. .sp .LP This function shall not return an error code of [EINTR]. .LP \fIThe following sections are informative.\fP .SH EXAMPLES .LP None. .SH APPLICATION USAGE .LP None. .SH RATIONALE .LP None. .SH FUTURE DIRECTIONS .LP None. .SH SEE ALSO .LP \fImmap\fP() , \fIposix_typed_mem_open\fP() , the Base Definitions volume of IEEE\ Std\ 1003.1-2001, \fI\fP .SH COPYRIGHT Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .