File: mmap.2

package info (click to toggle)
manpages-es 0.4a-2
  • links: PTS
  • area: main
  • in suites: hamm, slink
  • size: 3,592 kB
  • ctags: 3
  • sloc: sh: 59; makefile: 42
file content (169 lines) | stat: -rw-r--r-- 4,753 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
.\" 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>
.\" Translation fixed 12/4/1998 by Nicols Lichtmaier <nick@debian.org>
.\"
.TH MMAP 2 "12 de abril de 1996" "Linux 1.3.86" "Manual del Programador Linux"
.SH NOMBRE
mmap, munmap \- ubica o elimina ficheros o dispositivos en memoria
.SH SINTAXIS
.B #include <unistd.h>
.br
.B #include <sys/mman.h>
.sp
.BI "caddr_t mmap(void *" comienzo ", size_t " largo ", int " prot
.BI ", int " flags ", int " fd ", off_t " desplazamiento );
.sp
.BI "int munmap(void *" comienzo ", size_t " largo );
.SH DESCRIPCIN
La funcin
.B mmap
pide mapear
.I largo
bytes comenzando en el desplazamiento
.I desplazamiento
del fichero (u otro objeto) espeficicado por
.I fd
a memoria, preferiblemente en la direccin
.IR comienzo .
Esta ltima direccin es slo una sugerencia y normalmente se especifica como 0. 
El verdadero lugar donde el objecto es ubicado es devuelto por
.BR mmap .
El argumento
.I prot
describe la proteccin de memoria deseada. Lo forman los siguientes bits
.TP
.B PROT_EXEC
Las pginas podrn ser ejecutadas.
.TP
.B PROT_READ
Las pginas podrn ser ledas.
.TP
.B PROT_WRITE
Las pginas podrn ser escritas.
.TP
.B PROT_NONE
Las pginas no podrn ser accedidas.
.LP
El parmetro
.I flags
especifica el tipo del objeto mapeado, las opciones, y si las modificaciones hechas a
la copia insertada en memoria son privadas al proceso o son compartidas por
otras referencias. Tiene los bits 
.TP
.B MAP_FIXED
No seleccionar una direccin diferente a la especificada. 
Si la direccin especificada no puede ser utilizada,
.B mmap
fallar. Si
.B MAP_FIXED
es especificado,
.I comienzo
debe ser un mltiplo del tamao de pgina. Se desaconseja el uso de esta opcin.
.TP
.B MAP_SHARED
Comparte este rea con todos los otros objetos que sealan a este objeto.
.TP
.B MAP_PRIVATE
Crear un rea privada "copy-on-write".
.LP
Debe especifirase exactamente uno de los parmetros
.B MAP_SHARED 
.BR MAP_PRIVATE .
.LP
Los tres parmetros anteriores estan descriptos en POSIX.1b (anteriormente POSIX.4).
Linux tambien reconoce
.BR MAP_DENYWRITE , \ MAP_EXECUTABLE
y
.BR MAP_ANON ( YMOUS ).

La llamada al sistema
.B munmap
borra las ubicaciones para el rango de direcciones especificado, y causa
que las futuras referencias a direcciones dentro de ese rango generen
referencias a memoria invlidas.

.SH "VALOR DEVUELTO"
Si ha funcionado
.B mmap
devuelve un puntero al rea reservada.
En caso de error, es devuelto \-1, y
.I errno
es asignada apropiadamente.
Si ha funcionado
.B munmap
devuelve 0, si hay error \-1, y
.I errno
es asignada (probablemente a
.BR EINVAL ).
.SH ERRORES
.TP
.B EBADF
.I fd
no es un descriptor de fichero vlido (y la opcin
.B MAP_ANONYMOUS
no ha sido indicada).
.TP
.B EACCES
La opcin
.B MAP_PRIVATE fue indicada, pero no se ha abierto
.I fd
para lectura. O se indic ambos
.B MAP_SHARED
y
.B PROT_WRITE
pero
.I fd
no est abierto para escritura.
.TP
.B EINVAL
No nos gusta
.IR comienzo ,
.I largo
o
.IR desplazamiento .
(p. ej. son demasiado grandes, o no estn alineados en un valor
mltiplo de PAGESIZE).
.TP
.B ETXTBUSY
Se indic la opcin
.B MAP_DENYWRITE
pero el objeto especificado por
.I fd
est abierto para escritura.
.TP
.B EAGAIN
El fichero ha sido bloqueado, o excesiva memoria ha sido bloqueada.
.TP
.B ENOMEM
No hay memoria disponible.
.SH "COMPATIBLE CON"
SVr4, POSIX.1b (anteriormente POSIX.4), 4.4BSD.  Svr4 documenta
los cdigos de error ENXIO y ENODEV.
.SH "VASE TAMBIN"
.BR getpagesize (2),
.BR msync (2),
.BR shm_open (2),
B.O. Gallmeister, POSIX.4, O'Reilly, pp. 128-129 and 389-391.