OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / original / 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@gmail.com>
26 .\"     Added description of mmap2
27 .\" Modified, 2004-11-25, mtk -- removed stray #endif in prototype
28 .\"
29 .TH MMAP2 2 2008-04-22 "Linux" "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 .sp
36 .BI "void *mmap2(void *" addr ", size_t " length ", int " prot ,
37 .BI "             int " flags ", int " fd ", off_t " pgoffset );
38 .fi
39 .SH DESCRIPTION
40 The
41 .BR mmap2 ()
42 system call operates in exactly the same way as
43 .BR mmap (2),
44 except that the final argument specifies the offset into the
45 file in 4096-byte units (instead of bytes, as is done by
46 .BR mmap (2)).
47 This enables applications that use a 32-bit
48 .I off_t
49 to map large files (up to 2^44 bytes).
50 .SH "RETURN VALUE"
51 On success,
52 .BR mmap2 ()
53 returns a pointer to the mapped area.
54 On error \-1 is returned and
55 .I errno
56 is set appropriately.
57 .SH ERRORS
58 .TP
59 .B EFAULT
60 Problem with getting the data from userspace.
61 .TP
62 .B EINVAL
63 (Various platforms where the page size is not 4096 bytes.)
64 .I offset * 4096
65 is not a multiple of the system page size.
66 .PP
67 .BR mmap2 ()
68 can return any of the same errors as
69 .BR mmap (2).
70 .SH VERSIONS
71 .BR mmap2 ()
72 is available since Linux 2.3.31.
73 .SH "CONFORMING TO"
74 This system call is Linux-specific.
75 .SH NOTES
76 Nowadays, the glibc
77 .BR mmap ()
78 wrapper function invokes this system call rather than the
79 .BR mmap (2)
80 system call.
81
82 On ia64, the unit for
83 .I offset
84 is actually the system page size, rather than 4096 bytes.
85 .\" ia64 can have page sizes ranging from 4kB to 64kB.
86 .\" On cris, it looks like the unit might also be the page size,
87 .\" which is 8192 bytes. -- mtk, June 2007
88 .SH "SEE ALSO"
89 .BR getpagesize (2),
90 .BR mmap (2),
91 .BR mremap (2),
92 .BR msync (2),
93 .BR shm_open (3)