.\" Automatically generated by Pandoc 2.9.2.1 .\" .TH "" "" "2023-05-26" "PMDK - " "PMDK Programmer's Manual" .hy .\" SPDX-License-Identifier: BSD-3-Clause .\" Copyright 2020, Intel Corporation .SH NAME .PP \f[B]pmem2_config_set_protection\f[R]() - set a protection flags in pmem2_config structure. .SH SYNOPSIS .IP .nf \f[C] #include 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); \f[R] .fi .SH DESCRIPTION .PP The \f[B]pmem2_config_set_protection\f[R]() function sets the protection flags which will be used for memory mapping. The default value in pmem2_config structure is \f[B]PMEM2_PROT_READ | PMEM2_PROT_WRITE\f[R]. The \f[I]argument describes the desired memory protection of the mapping. The memory protection cannot conflict with the file opening-mode. \f[R]*config* should be already initialized, please see \f[B]pmem2_config_new\f[R](3) for details. .PP It is either PROT_NONE or the bitwise OR of one or more of the following flags: .IP \[bu] 2 \f[B]PMEM2_PROT_EXEC\f[R] - Pages may be executed. .IP \[bu] 2 \f[B]PMEM2_PROT_READ\f[R] - Pages may be read. .IP \[bu] 2 \f[B]PMEM2_PROT_WRITE\f[R] - Pages may be written. .IP \[bu] 2 \f[B]PMEM2_PROT_NONE\f[R] - Pages may not be accessed. On Windows this flag is not supported. .SH RETURN VALUE .PP The \f[B]pmem2_config_set_protection\f[R]() function returns 0 on success or a negative error code on failure. .SH ERRORS .PP The \f[B]pmem2_config_set_protection\f[R]() can fail with the following errors: .IP \[bu] 2 \f[B]PMEM2_E_INVALID_PROT_FLAG\f[R] - some or all of the provided flags are not valid. .SH SEE ALSO .PP \f[B]libpmem2\f[R](7), \f[B]pmem2_config_new\f[R](3), \f[B]pmem2_map_new\f[R](3) and \f[B]\f[R]