PMEM2_SOURCE_FROM_ANON(3)
π NAME π
okay so pmem2_source_from_anon() β it literally creates a data source backed by anonymous memory pages. that's the whole vibe. it's part of the PMDK Programmer's Manual bestie, and yes we're about to get into it π«Ά
β¨ SYNOPSIS β¨
#include <libpmem2.h>
int pmem2_source_from_anon(struct pmem2_source **src, size_t size);
π¦ DESCRIPTION π¦
so pmem2_source_from_anon() instantiates a brand new struct pmem2_source object that describes an anonymous data source. main character energy fr π
here's the tea: mappings created using this function are not backed by any file β and they're zero-initialized. no file, all vibes, everything starts at zero πΈ
the size argument defines the length in bytes of the anonymous source, exactly as returned by pmem2_source_size(3). and bestie, you should set this value so that it's greater than or equal to the size of any mapping you create with the anonymous source. size it up properly, no cap π
also β the offset value for mapping is ignored. just straight up not invited to the party π
π RETURN VALUE π
pmem2_source_from_anon()returns0on success β slay β¨- or a negative error code on failure β not slay π
π ERRORS π
okay so pmem2_source_form_anon() can fail with the following errors:
-ENOMEMβ in case of insufficient memory to allocate an instance ofstruct pmem2_source. it's giving "your RAM said no" π
π SEE ALSO π
errno(3), pmem2_config_set_length(3), pmem2_map_new(3), pmem2_source_size(3), pmem2_config_set_length(3), libpmem2(7) and https://pmem.io
(and yes bestie, pmem2_config_set_length(3) really is listed twice β iconic of it honestly π)
that's the whole page!! this was PMDK, dated 2025-07-24. go forth and map your anonymous memory, bestie ππ¦πΈ
π¦ where this page comes from
- fedora 43: libpmem2-devel 2.1.0-4.fc43 Β· BSD-3-Clause
- π the page's license: BSD-3-Clause
- Copyright 2020, Intel Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms