1POSIX_TYPED_MEM_GET_INFO(3P)POSIX Programmer's ManuaPlOSIX_TYPED_MEM_GET_INFO(3P)
2
3
4

PROLOG

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

NAME

12       posix_typed_mem_get_info — query  typed  memory  information  (ADVANCED
13       REALTIME)
14

SYNOPSIS

16       #include <sys/mman.h>
17
18       int posix_typed_mem_get_info(int fildes,
19           struct posix_typed_mem_info *info);
20

DESCRIPTION

22       The   posix_typed_mem_get_info()   function   shall   return,   in  the
23       posix_tmi_length field of the posix_typed_mem_info structure pointed to
24       by  info, the maximum length which may be successfully allocated by the
25       typed memory object designated by fildes.  This  maximum  length  shall
26       take    into    account    the    flag    POSIX_TYPED_MEM_ALLOCATE   or
27       POSIX_TYPED_MEM_ALLOCATE_CONTIG specified when the typed memory  object
28       represented by fildes was opened. The maximum length is dynamic; there‐
29       fore, the value returned is valid only while the current mapping of the
30       corresponding typed memory pool remains unchanged.
31
32       If  fildes  represents  a  typed  memory object opened with neither the
33       POSIX_TYPED_MEM_ALLOCATE flag nor  the  POSIX_TYPED_MEM_ALLOCATE_CONTIG
34       flag specified, the returned value of info->posix_tmi_length is unspec‐
35       ified.
36
37       The posix_typed_mem_get_info() function may return additional implemen‐
38       tation-defined  information in other fields of the posix_typed_mem_info
39       structure pointed to by info.
40
41       If the memory object specified by fildes is not a typed memory  object,
42       then the behavior of this function is undefined.
43

RETURN VALUE

45       Upon  successful  completion,  the  posix_typed_mem_get_info() function
46       shall return zero; otherwise,  the  corresponding  error  status  value
47       shall be returned.
48

ERRORS

50       The posix_typed_mem_get_info() function shall fail if:
51
52       EBADF  The fildes argument is not a valid open file descriptor.
53
54       ENODEV The  fildes  argument  is  not connected to a memory object sup‐
55              ported by this function.
56
57       This function shall not return an error code of [EINTR].
58
59       The following sections are informative.
60

EXAMPLES

62       None.
63

APPLICATION USAGE

65       None.
66

RATIONALE

68       An application that needs to allocate a  block  of  typed  memory  with
69       length  dependent  upon  the  amount of memory currently available must
70       either query the typed memory object to obtain the amount available, or
71       repeatedly  invoke  mmap()  attempting  to guess an appropriate length.
72       While the latter method is existing practice with malloc(), it is  awk‐
73       ward  and  imprecise. The posix_typed_mem_get_info() function allows an
74       application to immediately determine available memory. This is particu‐
75       larly  important  for  typed  memory  objects that may in some cases be
76       scarce resources. Note that when  a  typed  memory  pool  is  a  shared
77       resource,  some  form  of  mutual-exclusion  or  synchronization may be
78       required while typed memory is being queried and allocated  to  prevent
79       race conditions.
80
81       The  existing  fstat()  function  is  not suitable for this purpose. We
82       realize that implementations may wish to provide  other  attributes  of
83       typed  memory  objects (for example, alignment requirements, page size,
84       and so on).  The fstat() function returns  a  structure  which  is  not
85       extensible  and,  furthermore, contains substantial information that is
86       inappropriate for typed memory objects.
87

FUTURE DIRECTIONS

89       None.
90

SEE ALSO

92       fstat(), mmap(), posix_typed_mem_open()
93
94       The Base Definitions volume of POSIX.1‐2017, <sys_mman.h>
95
97       Portions of this text are reprinted and reproduced in  electronic  form
98       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
99       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
100       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
101       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
102       event of any discrepancy between this version and the original IEEE and
103       The Open Group Standard, the original IEEE and The Open Group  Standard
104       is  the  referee document. The original Standard can be obtained online
105       at http://www.opengroup.org/unix/online.html .
106
107       Any typographical or formatting errors that appear  in  this  page  are
108       most likely to have been introduced during the conversion of the source
109       files to man page format. To report such errors,  see  https://www.ker
110       nel.org/doc/man-pages/reporting_bugs.html .
111
112
113
114IEEE/The Open Group                  2017         POSIX_TYPED_MEM_GET_INFO(3P)
Impressum