1()                         PMDK Programmer's Manual                         ()
2
3
4

NAME

6       pmem2_config_set_protection()  - set a protection flags in pmem2_config
7       structure.
8

SYNOPSIS

10              #include <libpmem2.h>
11
12              struct pmem2_config;
13
14              #define PMEM2_PROT_EXEC     (1U << 29)
15              #define PMEM2_PROT_READ     (1U << 30)
16              #define PMEM2_PROT_WRITE    (1U << 31)
17              #define PMEM2_PROT_NONE     0
18
19              int pmem2_config_set_protection(struct pmem2_config *cfg,
20                      unsigned prot);
21

DESCRIPTION

23       The pmem2_config_set_protection() function sets  the  protection  flags
24       which will be used for memory mapping.  The default value in pmem2_con‐
25       fig structure is PMEM2_PROT_READ | PMEM2_PROT_WRITE.  The argument  de‐
26       scribes  the desired memory protection of the mapping.  The memory pro‐
27       tection cannot conflict with the file opening-mode.  *config* should be
28       already initialized, please see pmem2_config_new(3) for details.
29
30       It  is either PROT_NONE or the bitwise OR of one or more of the follow‐
31       ing flags:
32
33PMEM2_PROT_EXEC - Pages may be executed.
34
35PMEM2_PROT_READ - Pages may be read.
36
37PMEM2_PROT_WRITE - Pages may be written.
38
39PMEM2_PROT_NONE - Pages may not be accessed.  On Windows this flag is
40         not supported.
41

RETURN VALUE

43       The  pmem2_config_set_protection()  function  returns 0 on success or a
44       negative error code on failure.
45

ERRORS

47       The pmem2_config_set_protection() can fail with the following errors:
48
49PMEM2_E_INVALID_PROT_FLAG - some or all of the provided flags are not
50         valid.
51

SEE ALSO

53       libpmem2(7),       pmem2_config_new(3),       pmem2_map_new(3)      and
54       <https://pmem.io>
55
56
57
58PMDK -                            2023-06-05                                ()
Impressum