pmem2_config_new - Man Page

allocate and free a configuration structure for a libpmem2 mapping


#include <libpmem2.h>

struct pmem2_config;
int pmem2_config_new(struct pmem2_config **cfg);
int pmem2_config_delete(struct pmem2_config **cfg);


The pmem2_config_new() function instantiates a new (opaque) configuration structure, pmem2_config, which is used to define mapping parameters for a pmem2_map_new() function, and returns it through the pointer in *cfg.

New configuration is always initialized with default values for most parameters, which are specified alongside the corresponding setter function. The application must explicitly set the granularity value for the mapping.

The pmem2_config_delete() function frees *cfg returned by pmem2_config_new() and sets *cfg to NULL. If *cfg is NULL, no operation is performed.

Return Value

The pmem2_config_new() function returns 0 on success or a negative error code on failure. pmem2_config_new() does set *cfg to NULL on failure.

The pmem2_config_delete() function always returns 0.


pmem2_config_new() can fail with the following error: - -ENOMEM - out of memory

See Also

errno(3), pmem2_map_new(3), pmem2_config_set_handle(3), pmem2_config_set_fd(3), pmem2_config_get_file_size(3), libpmem2(7) and <>

Referenced By

pmem2_config_set_length(3), pmem2_config_set_offset(3), pmem2_config_set_protection(3), pmem2_config_set_required_store_granularity(3), pmem2_config_set_sharing(3), pmem2_source_alignment(3), pmem2_source_size(3).

The man page pmem2_config_delete(3) is an alias of pmem2_config_new(3).

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