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