PMEM2_SOURCE_GET_HANDLE(3)
π pmem2_source_get_handle(3) β from the PMDK Programmer's Manual
okay bestie, buckle up, we're reading the actual file handle out of a data source π
β¨ NAME β¨
pmem2_source_get_handle() β reads file handler of the data source
πΈ SYNOPSIS πΈ
#include <libpmem2.h>
int pmem2_source_get_handle(const struct pmem2_source *src, HANDLE *h);
π¦ DESCRIPTION π¦
so like, pmem2_source_get_handle() does one thing and it does it well: it reads the file handler of the struct pmem2_source object that's describing your data source, and hands it right back to you through the h parameter. no cap, that's the whole vibe π
Windows only!! πͺ on Linux you're gonna want pmem2_source_get_fd(3) instead. different platform, different bestie.
now if your source was created using pmem2_source_from_fd(3), then pmem2_source_get_handle() is also a totally valid function to read the handler β because the file descriptor gets converted to a file handle during source creation. it's giving β¨glow upβ¨, the fd just becomes a handle.
however π there are limitations to what you can actually do with a handle created from a file descriptor. for the details, go read the DESCRIPTION section in the pmem2_source_from_fd(3) manpage. i'm not gatekeeping, i'm just saying it's all in there fr fr.
π ERRORS π
pmem2_source_get_handle() can fail with the following errors:
PMEM2_E_FILE_HANDLE_NOT_SETβ this one shows up in case of an instance ofstruct pmem2_sourcethat does not come from a source type that supports file handles, eg. an anonymous data source. π no handle to give you, sorry bestie.
π RETURN VALUE π
pmem2_source_get_handle() returns a file handle of the data source. iconic behavior honestly π
π SEE ALSO π
pmem2_source_from_fd(3), pmem2_source_get_fd(3), libpmem2(7) and <https://pmem.io>
and that's the whole page bestie π«Ά this was PMDK, dated 2023-05-31 β stay hydrated, go read the linked manpages, and remember: file handles are temporary, but knowing your platform is forever πβ¨
π¦ where this page comes from
- debian trixie: libpmem2-dev 1.13.1-1.1+b1 Β· BSD-3-Clause
- ubuntu noble: libpmem2-dev 1.13.1-1.1ubuntu2 Β· BSD-3-Clause
- ubuntu questing: libpmem2-dev 1.13.1-1.1ubuntu3
- ubuntu resolute: libpmem2-dev 1.13.1-1.1ubuntu4 Β· BSD-3-Clause
- ubuntu stonking: libpmem2-dev 1.13.1-1.1ubuntu5 Β· 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