pmem2_source_from_fd - Man Page

creates or deletes an instance of persistent memory data source


#include <libpmem2.h>

int pmem2_source_from_fd(struct pmem2_source *src, int fd);
int pmem2_source_delete(struct pmem2_source **src);


The pmem2_source_from_fd() function validates the file descriptor and instantiates a new *struct pmem2_source** object describing the data source.

fd must be opened with O_RDONLY or O_RDWR mode.

If fd is invalid, then the function fails.

The pmem2_source_delete() function frees *src returned by pmem2_source_from_fd() and sets *src to NULL. If *src is NULL, no operation is performed.

Return Value

The pmem2_source_from_fd() function return 0 on success or a negative error code on failure.

The pmem2_source_delete() function always returns 0.


The pmem2_source_from_fd() function can fail with the following errors:

The pmem2_source_from_fd() function can also return -ENOMEM in case of insufficient memory to allocate an instance of struct pmem2_source.

See Also

errno(3), pmem2_map_new(3), libpmem2(7) and <>

Referenced By

libpmem2(7), pmem2_map_from_existing(3), pmem2_map_new(3), pmem2_source_alignment(3), pmem2_source_numa_node(3), pmem2_source_pread_mcsafe(3).

The man page pmem2_source_delete(3) is an alias of pmem2_source_from_fd(3).

2024-01-25 PMDK - PMDK Programmer's Manual