POSIX_TYP..._GET_INFO(3P)
π POSIX_TYP..._GET_INFO(3P) π
okay bestie, so this one lives in the POSIX Programmer's Manual, section 3P, and it's literally called POSIX_TYP..._GET_INFO(3P) (the full name got squished by the terminal, we love a truncated queen π).
πΈ PROLOG πΈ
This manual page is part of the POSIX Programmer's Manual. Real talk though β the Linux implementation of this interface may differ (so go check the corresponding Linux manual page for the deets on how Linux actually does it), or honestly the interface might just not be implemented on Linux at all. No cap. π
β¨ NAME β¨
posix_typed_mem_get_info β query typed memory information (ADVANCED REALTIME)
like... it asks typed memory how much room it's got. iconic behavior honestly. π
π¦ SYNOPSIS π¦
#include <sys/mman.h>
int posix_typed_mem_get_info(int fildes,
struct posix_typed_mem_info *info);
π DESCRIPTION π
okay so here's the tea: posix_typed_mem_get_info() shall return, in the posix_tmi_length field of the posix_typed_mem_info structure pointed to by info, the maximum length which may be successfully allocated by the typed memory object designated by fildes. π«Ά
This maximum length shall take into account the flag POSIX_TYPED_MEM_ALLOCATE or POSIX_TYPED_MEM_ALLOCATE_CONTIG that was specified when the typed memory object represented by fildes was opened. And bestie, the maximum length is dynamic β therefore the value returned is valid only while the current mapping of the corresponding typed memory pool remains unchanged. so like, don't be out here caching it forever, it's giving fleeting. π
If fildes represents a typed memory object opened with neither the POSIX_TYPED_MEM_ALLOCATE flag nor the POSIX_TYPED_MEM_ALLOCATE_CONTIG flag specified, then the returned value of info->posix_tmi_length is unspecified. π
The posix_typed_mem_get_info() function may return additional implementation-defined information in other fields of the posix_typed_mem_info structure pointed to by info. surprise bonus fields, we love a mystery. β¨
and if the memory object specified by fildes is not a typed memory object, then the behavior of this function is undefined. so like... don't. π
π₯ RETURN VALUE π₯
Upon successful completion, the posix_typed_mem_get_info() function shall return zero; otherwise, the corresponding error status value shall be returned. simple as that, periodt. π
π ERRORS π
The posix_typed_mem_get_info() function shall fail if:
EBADFβ The fildes argument is not a valid open file descriptor. bestie that fd is not fding. πENODEVβ The fildes argument is not connected to a memory object supported by this function. wrong vibe entirely, not the right kind of object. π
This function shall not return an error code of [EINTR]. nope, not on the menu, not today. π
The following sections are informative.
π EXAMPLES π
None.
(no examples, she said "figure it out" π )
π§ APPLICATION USAGE π§
None.
(also empty, the silence is deafening π)
π RATIONALE π
okay so the reasoning, because you KNOW we needed one:
An application that needs to allocate a block of typed memory with length dependent upon the amount of memory currently available must either query the typed memory object to obtain the amount available, or repeatedly invoke mmap() attempting to guess an appropriate length. And like... the second option? While that method is existing practice with malloc(), it is awkward and imprecise. π
The posix_typed_mem_get_info() function allows an application to immediately determine available memory. This is particularly important for typed memory objects that may in some cases be scarce resources. π
Note that when a typed memory pool is a shared resource, some form of mutual-exclusion or synchronization may be required while typed memory is being queried and allocated to prevent race conditions. bestie please lock your stuff, we are not doing data races in this house. π«Ά
The existing fstat() function is not suitable for this purpose. We realize that implementations may wish to provide other attributes of typed memory objects (for example, alignment requirements, page size, and so on). The fstat() function returns a structure which is not extensible and, furthermore, contains substantial information that is inappropriate for typed memory objects. so yeah, fstat() is not the moment. π
βοΈ
β FUTURE DIRECTIONS β
None.
(nothing coming, we're at peace with it πΈ)
π SEE ALSO π
fstat()mmap()posix_typed_mem_open()
The Base Definitions volume of POSIX.1β2017, <sys_mman.h>
π COPYRIGHT π
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page bestie, we made it π«Ά this absolute baddie of a manpage came to you from IEEE/The Open Group, dated 2017, under the name POSIX_TYP..._GET_INFO(3P). go forth and query your typed memory, but like, safely. mwah. πβ¨
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms