161 lines
3.8 KiB
HTML
161 lines
3.8 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of MMAP2</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>MMAP2</H1>
|
|
Section: Linux Programmer's Manual (2)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
mmap2 - map files or devices into memory
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<PRE>
|
|
<B>#include <<A HREF="file:///usr/include/sys/mman.h">sys/mman.h</A>></B>
|
|
|
|
<B>void *mmap2(void *</B><I>addr</I><B>, size_t </B><I>length</I><B>, int </B><I>prot</I><B>,</B>
|
|
<B> int </B><I>flags</I><B>, int </B><I>fd</I><B>, off_t </B><I>pgoffset</I><B>);</B>
|
|
</PRE>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
This is probably not the system call that you are interested in; instead, see
|
|
<B><A HREF="/cgi-bin/man/man2html?2+mmap">mmap</A></B>(2),
|
|
|
|
which describes the glibc wrapper function that invokes this system call.
|
|
<P>
|
|
|
|
The
|
|
<B>mmap2</B>()
|
|
|
|
system call provides the same interface as
|
|
<B><A HREF="/cgi-bin/man/man2html?2+mmap">mmap</A></B>(2),
|
|
|
|
except that the final argument specifies the offset into the
|
|
file in 4096-byte units (instead of bytes, as is done by
|
|
<B><A HREF="/cgi-bin/man/man2html?2+mmap">mmap</A></B>(2)).
|
|
|
|
This enables applications that use a 32-bit
|
|
<I>off_t</I>
|
|
|
|
to map large files (up to 2^44 bytes).
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
On success,
|
|
<B>mmap2</B>()
|
|
|
|
returns a pointer to the mapped area.
|
|
On error, -1 is returned and
|
|
<I>errno</I>
|
|
|
|
is set appropriately.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>ERRORS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="1"><B>EFAULT</B>
|
|
|
|
<DD>
|
|
Problem with getting the data from user space.
|
|
<DT id="2"><B>EINVAL</B>
|
|
|
|
<DD>
|
|
(Various platforms where the page size is not 4096 bytes.)
|
|
<I>offset * 4096</I>
|
|
|
|
is not a multiple of the system page size.
|
|
</DL>
|
|
<P>
|
|
|
|
<B>mmap2</B>()
|
|
|
|
can also return any of the errors described in
|
|
<B><A HREF="/cgi-bin/man/man2html?2+mmap">mmap</A></B>(2).
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H2>VERSIONS</H2>
|
|
|
|
<B>mmap2</B>()
|
|
|
|
is available since Linux 2.3.31.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
This system call is Linux-specific.
|
|
<A NAME="lbAI"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
On architectures where this system call is present,
|
|
the glibc
|
|
<B>mmap</B>()
|
|
|
|
wrapper function invokes this system call rather than the
|
|
<B><A HREF="/cgi-bin/man/man2html?2+mmap">mmap</A></B>(2)
|
|
|
|
system call.
|
|
<P>
|
|
|
|
This system call does not exist on x86-64.
|
|
<P>
|
|
|
|
On ia64, the unit for
|
|
<I>offset</I>
|
|
|
|
is actually the system page size, rather than 4096 bytes.
|
|
|
|
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+getpagesize">getpagesize</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+mmap">mmap</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+mremap">mremap</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+msync">msync</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+shm_open">shm_open</A></B>(3)
|
|
|
|
<A NAME="lbAK"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="3"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="4"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="5"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="6"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DT id="7"><A HREF="#lbAF">ERRORS</A><DD>
|
|
<DT id="8"><A HREF="#lbAG">VERSIONS</A><DD>
|
|
<DT id="9"><A HREF="#lbAH">CONFORMING TO</A><DD>
|
|
<DT id="10"><A HREF="#lbAI">NOTES</A><DD>
|
|
<DT id="11"><A HREF="#lbAJ">SEE ALSO</A><DD>
|
|
<DT id="12"><A HREF="#lbAK">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:33 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|