Changeset View
Changeset View
Standalone View
Standalone View
head/lib/libc/sys/mmap.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. | ||||
.\" | .\" | ||||
.\" @(#)mmap.2 8.4 (Berkeley) 5/11/95 | .\" @(#)mmap.2 8.4 (Berkeley) 5/11/95 | ||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||
.\" | .\" | ||||
.Dd June 22, 2017 | .Dd June 20, 2019 | ||||
.Dt MMAP 2 | .Dt MMAP 2 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm mmap | .Nm mmap | ||||
.Nd allocate memory, or map files or devices into memory | .Nd allocate memory, or map files or devices into memory | ||||
.Sh LIBRARY | .Sh LIBRARY | ||||
.Lb libc | .Lb libc | ||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | |||||
.It Dv PROT_READ | .It Dv PROT_READ | ||||
Pages may be read. | Pages may be read. | ||||
.It Dv PROT_WRITE | .It Dv PROT_WRITE | ||||
Pages may be written. | Pages may be written. | ||||
.It Dv PROT_EXEC | .It Dv PROT_EXEC | ||||
Pages may be executed. | Pages may be executed. | ||||
.El | .El | ||||
.Pp | .Pp | ||||
In addition to these protection flags, | |||||
.Fx | |||||
provides the ability to set the maximum protection of a region allocated by | |||||
.Nm | |||||
and later altered by | |||||
.Xr mprotect 2 . | |||||
This is accomplished by | |||||
.Em or Ns 'ing | |||||
one or more | |||||
.Dv PROT_ | |||||
values wrapped in the | |||||
.Dv PROT_MAX() | |||||
macro into the | |||||
.Fa prot | |||||
argument. | |||||
.Pp | |||||
The | The | ||||
.Fa flags | .Fa flags | ||||
argument specifies the type of the mapped object, mapping options and | argument specifies the type of the mapped object, mapping options and | ||||
whether modifications made to the mapped copy of the page are private | whether modifications made to the mapped copy of the page are private | ||||
to the process or are to be shared with other references. | to the process or are to be shared with other references. | ||||
Sharing, mapping type and options are specified in the | Sharing, mapping type and options are specified in the | ||||
.Fa flags | .Fa flags | ||||
argument by | argument by | ||||
▲ Show 20 Lines • Show All 286 Lines • ▼ Show 20 Lines | |||||
.Fa offset | .Fa offset | ||||
argument, when | argument, when | ||||
.Fa fd | .Fa fd | ||||
referenced a regular file or shared memory. | referenced a regular file or shared memory. | ||||
.It Bq Er EINVAL | .It Bq Er EINVAL | ||||
An invalid value was passed in the | An invalid value was passed in the | ||||
.Fa prot | .Fa prot | ||||
argument. | argument. | ||||
.It Bq Er EINVAL | |||||
The | |||||
.Fa prot | |||||
argument contains permissions which are not a subset of the specified | |||||
maximum permissions. | |||||
.It Bq Er EINVAL | .It Bq Er EINVAL | ||||
An undefined option was set in the | An undefined option was set in the | ||||
.Fa flags | .Fa flags | ||||
argument. | argument. | ||||
.It Bq Er EINVAL | .It Bq Er EINVAL | ||||
Both | Both | ||||
.Dv MAP_PRIVATE | .Dv MAP_PRIVATE | ||||
and | and | ||||
▲ Show 20 Lines • Show All 98 Lines • Show Last 20 Lines |