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
12 posix_typed_mem_get_info - query typed memory information (ADVANCED
13 REALTIME)
14
16 #include <sys/mman.h>
17
18 int posix_typed_mem_get_info(int fildes,
19 struct posix_typed_mem_info *info);
20
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
59 This function shall not return an error code of [EINTR].
60
61 The following sections are informative.
62
64 None.
65
67 None.
68
70 An application that needs to allocate a block of typed memory with
71 length dependent upon the amount of memory currently available must
72 either query the typed memory object to obtain the amount available, or
73 repeatedly invoke mmap() attempting to guess an appropriate length.
74 While the latter method is existing practice with malloc(), it is awk‐
75 ward and imprecise. The posix_typed_mem_get_info() function allows an
76 application to immediately determine available memory. This is particu‐
77 larly important for typed memory objects that may in some cases be
78 scarce resources. Note that when a typed memory pool is a shared
79 resource, some form of mutual-exclusion or synchronization may be
80 required while typed memory is being queried and allocated to prevent
81 race conditions.
82
83 The existing fstat() function is not suitable for this purpose. We
84 realize that implementations may wish to provide other attributes of
85 typed memory objects (for example, alignment requirements, page size,
86 and so on). The fstat() function returns a structure which is not
87 extensible and, furthermore, contains substantial information that is
88 inappropriate for typed memory objects.
89
91 None.
92
94 fstat(), mmap(), posix_typed_mem_open(), the Base Definitions volume of
95 IEEE Std 1003.1-2001, <sys/mman.h>
96
98 Portions of this text are reprinted and reproduced in electronic form
99 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
100 -- Portable Operating System Interface (POSIX), The Open Group Base
101 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
102 Electrical and Electronics Engineers, Inc and The Open Group. In the
103 event of any discrepancy between this version and the original IEEE and
104 The Open Group Standard, the original IEEE and The Open Group Standard
105 is the referee document. The original Standard can be obtained online
106 at http://www.opengroup.org/unix/online.html .
107
108
109
110IEEE/The Open Group 2003 POSIX_TYPED_MEM_GET_INFO(3P)