Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/sys/mprotect.2
Show All 22 Lines | |||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
.\" SUCH DAMAGE. | .\" SUCH DAMAGE. | ||||
.\" | .\" | ||||
.\" @(#)mprotect.2 8.1 (Berkeley) 6/9/93 | .\" @(#)mprotect.2 8.1 (Berkeley) 6/9/93 | ||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||
.\" | .\" | ||||
.Dd August 3, 2016 | .Dd June 13, 2019 | ||||
.Dt MPROTECT 2 | .Dt MPROTECT 2 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm mprotect | .Nm mprotect | ||||
.Nd control the protection of pages | .Nd control the protection of pages | ||||
.Sh LIBRARY | .Sh LIBRARY | ||||
.Lb libc | .Lb libc | ||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||
Show All 20 Lines | |||||
No permissions at all. | No permissions at all. | ||||
.It Dv PROT_READ | .It Dv PROT_READ | ||||
The pages can be read. | The pages can be read. | ||||
.It Dv PROT_WRITE | .It Dv PROT_WRITE | ||||
The pages can be written. | The pages can be written. | ||||
.It Dv PROT_EXEC | .It Dv PROT_EXEC | ||||
The pages can be executed. | The pages can be executed. | ||||
.El | .El | ||||
.Pp | |||||
In addition to these protection flags, | |||||
.Fx | |||||
provides the ability to set the maximum protection of a region | |||||
(e.g., prevents | |||||
alc: I think "which" would be better than "e.g.". | |||||
.Nm | |||||
from upgrading the permissions). | |||||
This is accomplished by | |||||
.Em or Ns 'ing | |||||
one or more | |||||
.Dv PROT_ | |||||
value wrapped in the | |||||
alcUnsubmitted Done Inline Actions"values" instead of "value" alc: "values" instead of "value" | |||||
.Dv PROT_MAX() | |||||
macro into the | |||||
.Fa prot | |||||
argument. | |||||
.Sh RETURN VALUES | .Sh RETURN VALUES | ||||
.Rv -std mprotect | .Rv -std mprotect | ||||
.Sh ERRORS | .Sh ERRORS | ||||
The | The | ||||
.Fn mprotect | .Fn mprotect | ||||
system call will fail if: | system call will fail if: | ||||
.Bl -tag -width Er | .Bl -tag -width Er | ||||
.It Bq Er EINVAL | .It Bq Er EINVAL | ||||
The virtual address range specified by the | The virtual address range specified by the | ||||
.Fa addr | .Fa addr | ||||
and | and | ||||
.Fa len | .Fa len | ||||
arguments is not valid. | arguments is not valid. | ||||
.It Bq Er EINVAL | |||||
The | |||||
.Fa prot | |||||
argument contains unhandled bits. | |||||
markjUnsubmitted Done Inline ActionsOr the prot bits are not a subset of max_prot bits. mmap() should document that too. markj: Or the prot bits are not a subset of max_prot bits. mmap() should document that too. | |||||
.It Bq Er EACCES | .It Bq Er EACCES | ||||
The calling process was not allowed to change | The calling process was not allowed to change | ||||
the protection to the value specified by | the protection to the value specified by | ||||
the | the | ||||
.Fa prot | .Fa prot | ||||
argument. | argument. | ||||
.El | .El | ||||
.Sh SEE ALSO | .Sh SEE ALSO | ||||
Show All 9 Lines |
I think "which" would be better than "e.g.".