File: getpagesize.2

package info (click to toggle)
manpages-es 1.55-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 7,472 kB
  • ctags: 6
  • sloc: sh: 1,349; makefile: 63
file content (87 lines) | stat: -rw-r--r-- 3,100 bytes parent folder | download | duplicates (4)
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
.\" Copyright (C) 2001 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.
.\"
.\" Traducido por Miguel Pérez Ibars <mpi79470@alu.um.es> el 5-julio-2004
.\"
.TH GETPAGESIZE 2 "21 diciembre 2001" "Linux 2.5.0" "Manual del Programador de Linux"
.SH NOMBRE
getpagesize \- obtiene el tamaño de página de memoria
.SH SINOPSIS
.B #include <unistd.h>
.sp
.B int getpagesize(void);
.SH DESCRIPCIÓN
La función
.B getpagesize()
devuelve el número de bytes de una página, donde una "página" es
lo que se utiliza en la parte de la descripción de
.BR mmap (2)
que dice que los ficheros son ubicados en unidades de tamaño de página.

El tamaño del tipo de páginas que usa
.B mmap
, se averigua usando

.RS
.nf
#include <unistd.h>
long sz = sysconf(_SC_PAGESIZE);
.fi
.RE

(algunos sistemas también permiten el sinónimo _SC_PAGE_SIZE por _SC_PAGESIZE),
or

.RS
.nf
#include <unistd.h>
int sz = getpagesize();
.fi
.RE
.SH HISTORIA
Esta llamada apareció por primera vez en 4.2BSD.
.SH CONFORME A
SVr4, 4.4BSD, SUSv2.
En SUSv2 la llamada
.B getpagesize()
está etiquetada como "antigua", y en POSIX 1003.1-2001
ha sido eliminada.
HPUX no posee esta llamada..
.SH OBSERVACIONES
Que 
.B getpagesize()
esté presente como una llamada al sistema de Linux depende de la arquitectura.
Si lo está, devolverá el símbolo del núcleo PAGE_SIZE,
que es dependiente de la arquitectura y del modelo de máquina.
Generalmente, suelen usarse binarios que son dependientes de la arquitectura
pero no del modelo de máquina, con el fin de tener un único binario
por arquitectura. Esto significa que un programa de usuario
no debería incorporar PAGE_SIZE en tiempo de compilación de un fichero de cabecera,
sino usar una llamada al sistema real, al menos en aquellas 
arquitecturas (como sun4) donde exista esta dependencia.
Aquí fallan libc4, libc5 y glibc 2.0 porque su llamada
.B getpagesize()
devuelve un valor calculado estáticamente, y no utiliza una llamada al sistema.
Este aspecto está solucionado en la versión 2.1 de glibc.
.SH "VÉASE TAMBIÉN"
.BR mmap (2),
.BR sysconf (3)