]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/mmap2.2
spfix
[thirdparty/man-pages.git] / man2 / mmap2.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (C) 2002, Michael Kerrisk
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .\" Modified 31 Jan 2002, Michael Kerrisk <mtk-manpages@gmx.net>
26 .\" Added description of mmap2
27 .\" Modified, 2004-11-25, mtk -- removed stray #endif in prototype
28 .\"
29 .TH MMAP2 2 2002-01-31 "Linux 2.3.31" "Linux Programmer's Manual"
30 .SH NAME
31 mmap2 \- map files or devices into memory
32 .SH SYNOPSIS
33 .nf
34 .B #include <sys/mman.h>
35 .br
36 .B #include <syscall.h>
37 .br
38 .B #include <errno.h>
39 .sp
40 .BI "_syscall6(void *, " mmap2 ", void *, " start ", size_t, " length ,
41 .BI " int, " prot ", int, " flags ", int, " fd ", off_t, " pgoffset )
42 /* Using \fBsyscall\fP(2) may be preferable; see \fBintro\fP(2) */
43 .sp
44 .BI "void *mmap2(void *" start ", size_t " length ", int " prot ,
45 .BI " int " flags ", int " fd ", off_t " pgoffset );
46 .fi
47 .SH DESCRIPTION
48 The
49 .BR mmap2 ()
50 system call operates in exactly the same way as
51 .BR mmap (2),
52 except that the final argument specifies the offset into the
53 file in units of the system page size (instead of bytes).
54 This enables applications that use a 32-bit
55 .I off_t
56 to map
57 larger files (typically up to 2^44 bytes).
58 .SH "RETURN VALUE"
59 On success,
60 .BR mmap2 ()
61 returns a pointer to the mapped area.
62 On error \-1 is returned
63 and
64 .I errno
65 is set appropriately.
66 .SH ERRORS
67 .TP
68 EFAULT
69 Problem with getting the
70 data from userspace.
71 .SH NOTES
72 .BR mmap2 ()
73 is available since Linux 2.3.31.
74 It is Linux specific, and should be avoided in portable applications.
75 On 32-bit systems,
76 .BR mmap2 ()
77 is used to implement the
78 .BR mmap64 ()
79 function that is part of the LFS (Large File Summit).
80 .SH "CONFORMING TO"
81 This system call is Linux specific.
82 .SH "SEE ALSO"
83 .BR getpagesize (2),
84 .BR mmap (2),
85 .BR mremap (2),
86 .BR msync (2),
87 .BR shm_open (3)