1POSIX_TYPED_MEM_GET_INFO(3P)POSIX Programmer's ManuaPlOSIX_TYPED_MEM_GET_INFO(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_typed_mem_get_info — query typed memory information (ADVANCED
14 REALTIME)
15
17 #include <sys/mman.h>
18
19 int posix_typed_mem_get_info(int fildes,
20 struct posix_typed_mem_info *info);
21
23 The posix_typed_mem_get_info() function shall return, in the
24 posix_tmi_length field of the posix_typed_mem_info structure pointed to
25 by info, the maximum length which may be successfully allocated by the
26 typed memory object designated by fildes. This maximum length shall
27 take into account the flag POSIX_TYPED_MEM_ALLOCATE or
28 POSIX_TYPED_MEM_ALLOCATE_CONTIG specified when the typed memory object
29 represented by fildes was opened. The maximum length is dynamic; there‐
30 fore, the value returned is valid only while the current mapping of the
31 corresponding typed memory pool remains unchanged.
32
33 If fildes represents a typed memory object opened with neither the
34 POSIX_TYPED_MEM_ALLOCATE flag nor the POSIX_TYPED_MEM_ALLOCATE_CONTIG
35 flag specified, the returned value of info->posix_tmi_length is unspec‐
36 ified.
37
38 The posix_typed_mem_get_info() function may return additional implemen‐
39 tation-defined information in other fields of the posix_typed_mem_info
40 structure pointed to by info.
41
42 If the memory object specified by fildes is not a typed memory object,
43 then the behavior of this function is undefined.
44
46 Upon successful completion, the posix_typed_mem_get_info() function
47 shall return zero; otherwise, the corresponding error status value
48 shall be returned.
49
51 The posix_typed_mem_get_info() function shall fail if:
52
53 EBADF The fildes argument is not a valid open file descriptor.
54
55 ENODEV The fildes argument is not connected to a memory object sup‐
56 ported by this function.
57
58 This function shall not return an error code of [EINTR].
59
60 The following sections are informative.
61
63 None.
64
66 None.
67
69 An application that needs to allocate a block of typed memory with
70 length dependent upon the amount of memory currently available must
71 either query the typed memory object to obtain the amount available, or
72 repeatedly invoke mmap() attempting to guess an appropriate length.
73 While the latter method is existing practice with malloc(), it is awk‐
74 ward and imprecise. The posix_typed_mem_get_info() function allows an
75 application to immediately determine available memory. This is particu‐
76 larly important for typed memory objects that may in some cases be
77 scarce resources. Note that when a typed memory pool is a shared
78 resource, some form of mutual-exclusion or synchronization may be
79 required while typed memory is being queried and allocated to prevent
80 race conditions.
81
82 The existing fstat() function is not suitable for this purpose. We
83 realize that implementations may wish to provide other attributes of
84 typed memory objects (for example, alignment requirements, page size,
85 and so on). The fstat() function returns a structure which is not
86 extensible and, furthermore, contains substantial information that is
87 inappropriate for typed memory objects.
88
90 None.
91
93 fstat(), mmap(), posix_typed_mem_open()
94
95 The Base Definitions volume of POSIX.1‐2008, <sys_mman.h>
96
98 Portions of this text are reprinted and reproduced in electronic form
99 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
100 -- Portable Operating System Interface (POSIX), The Open Group Base
101 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
102 cal and Electronics Engineers, Inc and The Open Group. (This is
103 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
104 event of any discrepancy between this version and the original IEEE and
105 The Open Group Standard, the original IEEE and The Open Group Standard
106 is the referee document. The original Standard can be obtained online
107 at http://www.unix.org/online.html .
108
109 Any typographical or formatting errors that appear in this page are
110 most likely to have been introduced during the conversion of the source
111 files to man page format. To report such errors, see https://www.ker‐
112 nel.org/doc/man-pages/reporting_bugs.html .
113
114
115
116IEEE/The Open Group 2013 POSIX_TYPED_MEM_GET_INFO(3P)