PMEM2_SOURCE_GET_FD(3)
π pmem2_source_get_fd() β PMDK Programmer's Manual π
okay bestie, gather round, because today we're getting the file descriptor out of a data source and honestly? it's giving one-liner legend. this is a page from the PMDK Programmer's Manual, and it's short, it's sweet, it's iconic. no cap. π
β¨ NAME β¨
pmem2_source_get_fd() β reads file descriptor of the data source
πΈ SYNOPSIS πΈ
#include <libpmem2.h>
int pmem2_source_get_fd(const struct pmem2_source *src, int *fd);
likeβ¦ that's it. that's the whole vibe. one function, two args, zero drama. π
π¦ DESCRIPTION π¦
so the pmem2_source_get_fd() function reads the file descriptor of the struct pmem2_source object that's describing your data source, and hands it back to you through the fd parameter. that's the whole thing. it's a little peek-behind-the-curtain moment β you pass in your source, you get the fd back through the pointer. π«Ά
lowkey the most straightforward function on this whole manual page, and we love her for that.
β RETURN VALUE β
0on success β slay, you got your fd π- a negative error code on failure β not slay, go check ERRORS below
π ERRORS π
pmem2_source_get_fd() can fail with the following errors:
PMEM2_E_FILE_DESCRIPTOR_NOT_SETβ this one hits when you've got an instance ofstruct pmem2_sourcethat does not come from a source type that supports file descriptors, eg. an anonymous data source. so basically: no fd to read, bestie, because there was never one to begin with. π
fr fr, if your source is anonymous, don't come looking for a file descriptor. she's not there. she never was. π
π SEE ALSO π
and that's the whole page, bestie!! this was PMEM2_SOURCE_GET_FD(3) from the PMDK Programmer's Manual, dated 2025-07-24, brought to you by the fine humans of the PMDK project. go forth, grab those file descriptors, and stay iconic. πβ¨ππ¦πΈπ
ππ
π¦ 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-2023, Intel Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms