PMEM2_CONFIG_SET_PROTECTION(3) | PMDK Programmer's Manual | PMEM2_CONFIG_SET_PROTECTION(3) |
pmem2_config_set_protection() - set a protection flags in pmem2_config structure.
#include <libpmem2.h> struct pmem2_config; #define PMEM2_PROT_EXEC (1U << 29) #define PMEM2_PROT_READ (1U << 30) #define PMEM2_PROT_WRITE (1U << 31) #define PMEM2_PROT_NONE 0 int pmem2_config_set_protection(struct pmem2_config *cfg, unsigned prot);
The pmem2_config_set_protection() function sets the protection flags which will be used for memory mapping. The default value in pmem2_config structure is PMEM2_PROT_READ | PMEM2_PROT_WRITE. The argument describes the desired memory protection of the mapping. The memory protection cannot conflict with the file opening-mode. *config* should be already initialized, please see pmem2_config_new(3) for details.
It is either PROT_NONE or the bitwise OR of one or more of the following flags:
The pmem2_config_set_protection() function returns 0 on success or a negative error code on failure.
The pmem2_config_set_protection() can fail with the following errors:
libpmem2(7), pmem2_config_new(3), pmem2_map_new(3) and <https://pmem.io>
2022-08-25 | PMDK - pmem2 API version 1.0 |