1POSIX_MEM_OFFSET(3P) POSIX Programmer's Manual POSIX_MEM_OFFSET(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
11
13 posix_mem_offset — find offset and length of a mapped typed memory
14 block (ADVANCED REALTIME)
15
17 #include <sys/mman.h>
18
19 int posix_mem_offset(const void *restrict addr, size_t len,
20 off_t *restrict off, size_t *restrict contig_len,
21 int *restrict fildes);
22
24 The posix_mem_offset() function shall return in the variable pointed to
25 by off a value that identifies the offset (or location), within a mem‐
26 ory object, of the memory block currently mapped at addr. The function
27 shall return in the variable pointed to by fildes, the descriptor used
28 (via mmap()) to establish the mapping which contains addr. If that
29 descriptor was closed since the mapping was established, the returned
30 value of fildes shall be −1. The len argument specifies the length of
31 the block of the memory object the user wishes the offset for; upon
32 return, the value pointed to by contig_len shall equal either len, or
33 the length of the largest contiguous block of the memory object that is
34 currently mapped to the calling process starting at addr, whichever is
35 smaller.
36
37 If the memory object mapped at addr is a typed memory object, then if
38 the off and contig_len values obtained by calling posix_mem_offset()
39 are used in a call to mmap() with a file descriptor that refers to the
40 same memory pool as fildes (either through the same port or through a
41 different port), and that was opened with neither the
42 POSIX_TYPED_MEM_ALLOCATE nor the POSIX_TYPED_MEM_ALLOCATE_CONTIG flag,
43 the typed memory area that is mapped shall be exactly the same area
44 that was mapped at addr in the address space of the process that called
45 posix_mem_offset().
46
47 If the memory object specified by fildes is not a typed memory object,
48 then the behavior of this function is implementation-defined.
49
51 Upon successful completion, the posix_mem_offset() function shall
52 return zero; otherwise, the corresponding error status value shall be
53 returned.
54
56 The posix_mem_offset() function shall fail if:
57
58 EACCES The process has not mapped a memory object supported by this
59 function at the given address addr.
60
61 This function shall not return an error code of [EINTR].
62
63 The following sections are informative.
64
66 None.
67
69 None.
70
72 None.
73
75 None.
76
78 mmap(), posix_typed_mem_open()
79
80 The Base Definitions volume of POSIX.1‐2008, <sys_mman.h>
81
83 Portions of this text are reprinted and reproduced in electronic form
84 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
85 -- Portable Operating System Interface (POSIX), The Open Group Base
86 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
87 cal and Electronics Engineers, Inc and The Open Group. (This is
88 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
89 event of any discrepancy between this version and the original IEEE and
90 The Open Group Standard, the original IEEE and The Open Group Standard
91 is the referee document. The original Standard can be obtained online
92 at http://www.unix.org/online.html .
93
94 Any typographical or formatting errors that appear in this page are
95 most likely to have been introduced during the conversion of the source
96 files to man page format. To report such errors, see https://www.ker‐
97 nel.org/doc/man-pages/reporting_bugs.html .
98
99
100
101IEEE/The Open Group 2013 POSIX_MEM_OFFSET(3P)