PMEM2_CONFIG_SET_OFFSET(3)
π pmem2_config_set_offset() π
okay bestie, gather round, because today we're talking about pmem2_config_set_offset() from the PMDK Programmer's Manual β yes, the libpmem2 girlies, we love them here. this one sets the offset in the pmem2_config structure. that's it. that's the function. slay. β¨
πΈ SYNOPSIS πΈ
#include <libpmem2.h>
struct pmem2_config;
int pmem2_config_set_offset(struct pmem2_config *config, size_t offset);
like. look at her. two args, one int return, zero drama. π
π¦ DESCRIPTION π¦
so pmem2_config_set_offset() configures the offset that's gonna be used to map the contents from the specified location of the source. it's giving "start reading from here actually". π
important tho: *config should already be initialized before you call this. please see pmem2_config_new(3) for the details, don't come at her uninitialized, that's not the vibe. π
and the value has to be a multiple of the alignment required for the config. yes this is a real requirement, not a suggestion. the alignment requirements are specific to a data source, so like, they change depending on what you're working with. to retrieve the alignment required for a specific instance of pmem2_source, use pmem2_source_alignment(3). go ask her, she'll tell you. π§
oh and by default? the offset is 0. classic. main character energy, starts at zero. β
π RETURN VALUE π
pmem2_config_set_offset() returns 0 on success, or a negative error code on failure. that's it, that's the whole story. 0 = we ate. negative = we did not eat. π
π₯ ERRORS π₯
she can fail, and here's how, bestie:
PMEM2_E_OFFSET_OUT_OF_RANGEβ argument out of range, offset is greater thanINT64_MAX
so if your offset is bigger than INT64_MAX, she's gonna say no. and honestly? fair. that's a lot of offset. π
π SEE ALSO π
libpmem2(7), pmem2_source_alignment(3), pmem2_config_new(3), pmem2_map_new(3), sysconf(3) and https://pmem.io
and that's the whole page, no notes, no cap. go forth and set your offsets correctly, the alignment is not gonna check itself. π«Ά
this has been your girl, signing off on behalf of the PMDK crew β dated 2025-07-24, version PMDK. mwah. ππ
π¦ 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