PMEM2_CONFIG_SET_SHARING(3)
π pmem2_config_set_sharing(3) π
okay bestie, sit DOWN, because we're doing a lil deep dive into the PMDK Programmer's Manual together and this one is a genuine bop. it's a libpmem2 function, it's three-ish lines long, and it controls whether your writes are everyone's business or nobody's business. obsessed. let's go π¦
β¨ NAME β¨
pmem2_config_set_sharing() β literally just "set sharing in the pmem2_config structure". that's the whole job. she's a one-task queen π
β¨ SYNOPSIS β¨
#include <libpmem2.h>
struct pmem2_config;
enum pmem2_sharing_type {
PMEM2_SHARED,
PMEM2_PRIVATE,
};
int pmem2_config_set_sharing(struct pmem2_config *config, enum pmem2_sharing_type sharing);
so you're pulling in <libpmem2.h>, you've got an opaque lil struct pmem2_config (no peeking inside, she's mysterious π), you've got an enum pmem2_sharing_type with exactly two moods β PMEM2_SHARED and PMEM2_PRIVATE β and then the function itself takes a struct pmem2_config *config plus an enum pmem2_sharing_type sharing and gives you back an int. iconic signature, no notes β
πΈ DESCRIPTION πΈ
the pmem2_config_set_sharing() function configures the behavior and visibility of writes to the mapping's pages. yes. that's the whole vibe check. it's deciding whether your writes are loud and public or quiet and personal. the possible values are listed below, and bestie, there are exactly two:
PMEM2_SHAREDβ writes are made directly to the underlying memory, making them visible to other mappings of the same memory region. this is the default, so if you never call this function at all, this is what you're getting. main character energy by default, fr fr π₯PMEM2_PRIVATEβ writes do not affect the underlying memory and are not visible to other mappings of the same memory region. she's private, she's keeping it to herself, nobody else sees a thing π
β¨ RETURN VALUE β¨
pmem2_config_set_sharing() returns 0 on success or a negative error code on failure. so: 0 = slay, negative = not slay π
π ERRORRS π
yes the heading is spelled like that, we're keeping it, it's part of the lore π«Ά
the pmem2_config_set_sharing() can fail with the following errors:
PMEM2_E_INVALID_SHARING_VALUEβ sharing value is invalid. you handed her a sharing value that isn't a thing, bestie. she cannot work with that. π
π SEE ALSO π
and that's the whole page, periodt π this was the PMDK Programmer's Manual, dated 2025-07-24 β so go forth, set your sharing, and remember: shared is the default, private is for when you're feeling mysterious. mwah, bye 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