summaryrefslogtreecommitdiff
path: root/man3p/posix_mem_offset.3p
blob: a95bbe9dccfb1541ea8bdf1a89d33a53b0276075 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
.TH "POSIX_MEM_OFFSET" 3P 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 <sys/mman.h>
.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<sys/mman.h>\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 .