.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
.TH "<sys/mman.h>" 0P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" <sys/mman.h>
.SH NAME
sys/mman.h \- memory management declarations
.SH SYNOPSIS
.LP
\fB#include <sys/mman.h>\fP
.SH DESCRIPTION
.LP
The \fI<sys/mman.h>\fP header shall be supported if the implementation
supports at least one of the following
options:
.IP " *" 3
The Memory Mapped Files option
.LP
.IP " *" 3
The Shared Memory Objects option
.LP
.IP " *" 3
The Process Memory Locking option
.LP
.IP " *" 3
The Memory Protection option
.LP
.IP " *" 3
The Typed Memory Objects option
.LP
.IP " *" 3
The Synchronized Input and Output option
.LP
.IP " *" 3
The Advisory Information option
.LP
.IP " *" 3
The Typed Memory Objects option
.LP
.LP
If one or more of the Advisory Information, Memory Mapped Files, or
Shared Memory Objects options are supported, the following
protection options shall be defined:
.TP 7
PROT_READ
Page can be read.
.TP 7
PROT_WRITE
Page can be written.
.TP 7
PROT_EXEC
Page can be executed.
.TP 7
PROT_NONE
Page cannot be accessed.
.sp
.LP
The following \fIflag\fP options shall be defined:
.TP 7
MAP_SHARED
Share changes.
.TP 7
MAP_PRIVATE
Changes are private.
.TP 7
MAP_FIXED
Interpret \fIaddr\fP exactly.
.sp
.LP
The following flags shall be defined for \fImsync\fP():
.TP 7
MS_ASYNC
Perform asynchronous writes.
.TP 7
MS_SYNC
Perform synchronous writes.
.TP 7
MS_INVALIDATE
Invalidate mappings.
.sp
.LP
The following symbolic constants shall be defined for the \fImlockall\fP()
function:
.TP 7
MCL_CURRENT
Lock currently mapped pages.
.TP 7
MCL_FUTURE
Lock pages that become mapped.
.sp
.LP
The symbolic constant MAP_FAILED shall be defined to indicate a failure
from the \fImmap\fP() function.
.LP
If the Advisory Information and either the Memory Mapped Files or
Shared Memory Objects options are supported, values for
\fIadvice\fP used by \fIposix_madvise\fP() shall be defined as follows:
.TP 7
POSIX_MADV_NORMAL
.sp
The application has no advice to give on its behavior with respect
to the specified range. It is the default characteristic if no
advice is given for a range of memory.
.TP 7
POSIX_MADV_SEQUENTIAL
.sp
The application expects to access the specified range sequentially
from lower addresses to higher addresses.
.TP 7
POSIX_MADV_RANDOM
.sp
The application expects to access the specified range in a random
order.
.TP 7
POSIX_MADV_WILLNEED
.sp
The application expects to access the specified range in the near
future.
.TP 7
POSIX_MADV_DONTNEED
.sp
The application expects that it will not access the specified range
in the near future.
.sp
.LP
The following flags shall be defined for \fIposix_typed_mem_open\fP():
.TP 7
POSIX_TYPED_MEM_ALLOCATE
.sp
Allocate on \fImmap\fP().
.TP 7
POSIX_TYPED_MEM_ALLOCATE_CONTIG
.sp
Allocate contiguously on \fImmap\fP().
.TP 7
POSIX_TYPED_MEM_MAP_ALLOCATABLE
.sp
Map on \fImmap\fP(), without affecting allocatability.
.sp
.LP
The \fBmode_t\fP, \fBoff_t\fP, and \fBsize_t\fP types shall be defined
as described in \fI<sys/types.h>\fP .
.LP
The \fI<sys/mman.h>\fP header shall define the structure \fBposix_typed_mem_info\fP,
which includes at least the
following member:
.sp
.RS
.nf
\fBsize_t posix_tmi_length \fP Maximum length which may be allocated \fB
\fP from a typed memory object. \fB
\fP
.fi
.RE
.LP
The following shall be declared as functions and may also be defined
as macros. Function prototypes shall be provided.
.sp
.RS
.nf
\fB
int mlock(const void *, size_t);
int mlockall(int);
void *mmap(void *, size_t, int, int, int, off_t);
int mprotect(void *, size_t, int);
int msync(void *, size_t, int);
int munlock(const void *, size_t);
int munlockall(void);
int munmap(void *, size_t);
int posix_madvise(void *, size_t, int);
int posix_mem_offset(const void *restrict, size_t, off_t *restrict,
size_t *restrict, int *restrict);
int posix_typed_mem_get_info(int, struct posix_typed_mem_info *);
int posix_typed_mem_open(const char *, int, int);
int shm_open(const char *, int, mode_t);
int shm_unlink(const char *);
\fP
.fi
.RE
.LP
\fIThe following sections are informative.\fP
.SH APPLICATION USAGE
.LP
None.
.SH RATIONALE
.LP
None.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fI<sys/types.h>\fP, the System Interfaces volume of
IEEE\ Std\ 1003.1-2001, \fImlock\fP(), \fImlockall\fP(), \fImmap\fP(),
\fImprotect\fP(), \fImsync\fP(), \fImunlock\fP(), \fImunlockall\fP(),
\fImunmap\fP(), \fIposix_mem_offset\fP(),
\fIposix_typed_mem_get_info\fP(), \fIposix_typed_mem_open\fP(), \fIshm_open\fP(),
\fIshm_unlink\fP()
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .
|