Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/mman.h
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Protections are chosen from these bits, or-ed together | * Protections are chosen from these bits, or-ed together | ||||
*/ | */ | ||||
#define PROT_NONE 0x00 /* no permissions */ | #define PROT_NONE 0x00 /* no permissions */ | ||||
#define PROT_READ 0x01 /* pages can be read */ | #define PROT_READ 0x01 /* pages can be read */ | ||||
#define PROT_WRITE 0x02 /* pages can be written */ | #define PROT_WRITE 0x02 /* pages can be written */ | ||||
#define PROT_EXEC 0x04 /* pages can be executed */ | #define PROT_EXEC 0x04 /* pages can be executed */ | ||||
#if __BSD_VISIBLE | |||||
#define _PROT_ALL (PROT_READ|PROT_WRITE|PROT_EXEC) | |||||
kib: This pollutes std-defined namespace. Also note that there are parallel VM_PROT_ symbols with… | |||||
Done Inline ActionsUsing PROT_EXTRACT() name would put this macro into same namespace (PROT_ prefix) as the other definitions. POSIX reserves the whole PROT_* namespace for sys/mman.h so it definitely would be better than EXTRACT_PROT. kib: Using PROT_EXTRACT() name would put this macro into same namespace (PROT_ prefix) as the other… | |||||
kibUnsubmitted Done Inline ActionsThere should be spaces around '|'. kib: There should be spaces around '|'. | |||||
#define PROT_EXTRACT(prot) ((prot) & _PROT_ALL) | |||||
#define _PROT_MAX_SHIFT 16 | |||||
#define PROT_MAX(prot) ((prot) << _PROT_MAX_SHIFT) | |||||
#define PROT_MAX_EXTRACT(prot) (((prot) >> _PROT_MAX_SHIFT) & _PROT_ALL) | |||||
#endif | |||||
/* | /* | ||||
* Flags contain sharing type and options. | * Flags contain sharing type and options. | ||||
* Sharing types; choose one. | * Sharing types; choose one. | ||||
*/ | */ | ||||
#define MAP_SHARED 0x0001 /* share changes */ | #define MAP_SHARED 0x0001 /* share changes */ | ||||
#define MAP_PRIVATE 0x0002 /* changes are private */ | #define MAP_PRIVATE 0x0002 /* changes are private */ | ||||
#if __BSD_VISIBLE | #if __BSD_VISIBLE | ||||
▲ Show 20 Lines • Show All 217 Lines • Show Last 20 Lines |
This pollutes std-defined namespace. Also note that there are parallel VM_PROT_ symbols with more bits defined and it seems to conflict with your allocation for maxprot.