| Main index | Section 9 | Options |
#include <sys/param.h>
#include <vm/vm.h>
#include <vm/vm_map.h>
If the flags argument has the VM_MAP_PROTECT_SET_PROT bit set, then the effective protection is set to new_prot.
If the flags argument has the VM_MAP_PROTECT_SET_MAXPROT bit set, then the maximum protection is set to new_maxprot. Protection bits not included into new_maxprot will be cleared from existing entries.
The values specified by new_prot and new_maxprot are not allowed to include any protection bits that are not set in existing max_protection on every entry within the range. The operation will fail if this condition is violated. For instance, this prevents upgrading a shared mapping of a read-only file from read-only to read-write.
The specified range must not contain sub-maps.
| KERN_SUCCESS | The specified protection bits were set successfully. |
| KERN_INVALID_ARGUMENT | A sub-map entry was encountered in the range, |
| KERN_PROTECTION_FAILURE | The value of new_prot or new_maxprot exceed max_protection for an entry within the range. |
| KERN_PROTECTION_FAILURE | The map does not allow simultaneous setting of write and execute permissions, but new_prot has both VM_PROT_WRITE and VM_PROT_EXECUTE set. |
| KERN_RESOURCE_SHORTAGE | A copy-on-write mapping is transitioned from read-only to read-write, and not enough swap space is available to back the copied pages. |
| KERN_OUT_OF_BOUNDS | Both new protection and new maximum protection updates were requested, but the specified new_prot is not a subset of new_maxprot. |
| VM_MAP_PROTECT (9) | January 23, 2021 |
| Main index | Section 9 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
