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