.\" Copyright (C) 2001 Andries Brouwer .\" .\" 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 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 .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 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 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)