File: mmap.2

package info (click to toggle)
manpages-ja 0.4.0.0.20000115-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 8,760 kB
  • ctags: 3
  • sloc: sh: 6,269; perl: 155; makefile: 55
file content (173 lines) | stat: -rw-r--r-- 4,955 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" Copyright (C) 1996 Andries Brouwer (aeb@cwi.nl)
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one
.\" 
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date.  The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein.  The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\" 
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Modified Fri Jan 31 16:38:25 1997 by Eric S. Raymond <esr@thyrsus.com>
.\"
.\" Japanese Version Copyright (c) 1997 SUTO, Mitsuaki
.\"         all rights reserved.
.\" Translated Thu Jun 26 21:00:25 JST 1997
.\"         by SUTO, Mitsuaki <suto@av.crl.sony.co.jp>
.\" Updated & Modified Mon Mar 1 1999
.\"         by NAKANO Takeo <nakano@apm.seikei.ac.jp>
.\"
.\"WORD		file descriptor		ե뵭һ
.\"
.TH MMAP 2 "12 April 1996" "Linux 1.3.86" "Linux Programmer's Manual"
.SH ̾
mmap, munmap \- եǥХ˥ޥå/ޥåפ
.SH 
.B #include <unistd.h>
.br
.B #include <sys/mman.h>
.sp
.B #ifdef _POSIX_MAPPED_FILES
.sp
.BI "void * mmap(void *" start ", size_t " length ", int " prot
.BI ", int " flags ", int " fd ", off_t " offset );
.sp
.BI "int munmap(void *" start ", size_t " length );
.sp
.B #endif
.SH 
.B mmap
ؿ
.I fd
ǻꤵ줿ե(⤷Ϥ¾Υ֥)Ρեå
.I offset

.I length
ХȤϰϤ˥ޥåפ(ĥդ)
ΤȤʤ٤
.IR start
ɥ쥹Ϥ褦˥ޥåפ롣Υɥ쥹ϼºݤϴؿФ
ΥҥȤǤʤ̾ 0 ꤹ롣
ºݤ˥֥Ȥޥåפ줿ɥ쥹
.BR mmap
֤ͤ˥åȤ롣

.I prot
ˤϥݸɤΤ褦˹Ԥʤ(Υ꤬ɤΤ褦˻Ȥ뤫)
ꤹ롣
ʲΤ褦ʥӥåȥǡ¸ߤ롣
.TP 1.1i
.B PROT_EXEC
ڡϼ¹ԲǽǤ롣
.TP
.B PROT_READ
ڡɤ߹߲ǽǤ롣
.TP
.B PROT_WRITE
ڡ˽񤭹߲ǽǤ롣
.TP
.B PROT_NONE
ڡˤϥǤʤ
.LP

.I flags
ˤϡޥåפ줿֥ȤΥסޥå׻ΥץȤȤˡ
ޥåפ줿ڡԡؤѹԤΤƤӽФץʤΤ
Ȥ⤽Υڡ򻲾Ȥ¾ΥץǽʤΤꤹ롣
ʲΤ褦ʥӥåȥǡ¸ߤ롣
.TP 1.1i
.B MAP_FIXED
ꤵ줿ɥ쥹ʳΥɥ쥹˥ޥåԥ󥰤Ԥʤʤ
⤷ꤵ줿ɥ쥹ѤǤʤ硢
.B mmap
ϼԤ롣 MAP_FIXED ꤷ
.I start
ϥڡܿǤʤƤϤʤ
ΥץϻѤʤɤ
.TP
.B MAP_SHARED
Υޥåԥ󥰤򡢤Υ֥Ȥޥåפ
ƤΥץǶͭ롣
.TP
.B MAP_PRIVATE
ץ饤١Ȥ copy-on-write (񤭹߻ԡ) ޥåפ롣
.LP
MAP_SHARED  MAP_PRIVATE ϡɬɤ餫ҤȤĤ
ꤷʤФʤʤ
.LP
ʾ3ĤΥե饰 POSIX.1b ( POSIX.4) ǵꤵƤ롣
Linux ˤϤ¾ MAP_DENYWRITE, MAP_EXECUTABLE, MAP_ANON(YMOUS)

ƥॳ
.B munmap
ϻꤵ줿ɥ쥹ϰϤΥޥåפõʹߤΤϰؤλȤ
̵ʥ껲Ȥˤ롣

.SH ֤
.B mmap
ȥޥåפ줿ΰؤΥݥ󥿤֤
Ԥ MAP_FAILED (\-1) ֤
.I errno
顼ƤˤäƥåȤ롣
.B munmap
 0 ֤Ԥ \-1 ֤
.I errno
åȤ (餯 EINVAL ˤʤ)
.SH 顼
.TP
.B EBADF
.I fd
ͭʥե뵭һ (file descriptor) ǤϤʤ
( MAP_ANONYMOUS åȤƤʤ)
.TP
.B EACCES
MAP_PRIVATE ׵ᤷ
.I fd
ɤ߹Ѥ˥ץ󤵤Ƥʤ
ޤ MAP_SHARED ׵ᤷ PROT_WRITE 򥻥åȤ
.I fd
Ͻ񤭹Ѥ˥ץ󤵤Ƥʤ
.TP
.B EINVAL
.I start

.I length

.IR offset 
դʤ
(Ĥޤ礭뤫 PAGESIZE ˥饤ȤƤʤ)
.TP
.B ETXTBUSY
MAP_DENYWRITE åȤƤ뤬
.I fd
ǻꤵƤ륪֥ȤϽ񤭹Ѥ˳Ƥ롣
.TP
.B EAGAIN
ե뤬åƤ롣ޤϥåƤ꤬¿롣
.TP
.B ENOMEM
˶ʤ
.SH 
SVr4, POSIX.1b ( POSIX.4), 4.4BSDSVr4 ˤ¾ ENXIO  ENODEV 
Υ顼ɤˤĤƤεҤ롣
.SH Ϣ
.BR getpagesize (2),
.BR msync (2),
.BR shm_open (2),
B.O. Gallmeister, POSIX.4, O'Reilly, pp. 128-129 and 389-391.