PMEM2_SOURCE_GET_HANDLE(3)

πŸ“¦
version 1.13.1 Β· 4 versions
, in debian trixie, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’… 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 of struct pmem2_source that 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