pmem2_source_size - Man Page

returns the size of the data source


#include <libpmem2.h>

struct pmem2_source;
int pmem2_source_size(const struct pmem2_source *source, size_t *size);


The pmem2_source_size() function retrieves the size of the file in bytes pointed by file descriptor or handle stored in the source and puts it in *size.

This function is a portable replacement for OS-specific APIs. On Linux, it hides the quirkiness of Device DAX size detection.

Return Value

The pmem2_source_size() function returns 0 on success. If the function fails, the *size variable is left unmodified and a negative error code is returned.


The pmem2_source_size() can fail with the following errors:

On all systems:

On Windows:

On Linux:

On FreeBSD:

See Also

errno(3), fstat(2), realpath(3), open(2), read(2), strtoull(3), pmem2_config_new(3), libpmem2(7) and <>

Referenced By

pmem2_map_new(3), pmem2_source_from_anon(3).

2022-08-25 PMDK - pmem2 API version 1.0 PMDK Programmer's Manual