OSDN Git Service

(split) DP: release pages (catch up to 3.50).
[linuxjm/LDP_man-pages.git] / release / man2 / getpagesize.2
1 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\"*******************************************************************
26 .\"
27 .\" This file was generated with po4a. Translate the source file.
28 .\"
29 .\"*******************************************************************
30 .TH GETPAGESIZE 2 2010\-11\-16 Linux "Linux Programmer's Manual"
31 .SH 名前
32 getpagesize \- メモリのページ・サイズを取得する
33 .SH 書式
34 \fB#include <unistd.h>\fP
35 .sp
36 \fBint getpagesize(void);\fP
37 .sp
38 .in -4n
39 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
40 .in
41 .sp
42 \fBgetpagesize\fP():
43 .ad l
44 .RS 4
45 .PD 0
46 .TP  4
47 glibc 2.12 以降:
48 .nf
49 _BSD_SOURCE ||
50     !(_POSIX_C_SOURCE\ >=\ 200112L || _XOPEN_SOURCE\ >=\ 600)
51 .TP  4
52 .fi
53 glibc 2.12 より前: _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
54 .PD
55 .RE
56 .ad b
57 .SH 説明
58 .\" .SH HISTORY
59 .\" This call first appeared in 4.2BSD.
60 \fBgetpagesize\fP() 関数はメモリページの大きさをバイト数で返す。
61 ここでいう「ページ」は固定長のブロックであり、
62 \fBmmap\fP(2) で実行されるメモリ割り当てとファイルマッピングの単位である。
63 .SH 準拠
64 SVr4, 4.4BSD, SUSv2.
65 SUSv2 では \fBgetpagesize\fP() システムコールは「過去の遺物 (LEGACY)」とされており、
66 POSIX.1\-2001 からは外されている。 HP\-UX にはこのシステムコールは存在しない。
67 .SH 注意
68 移植性が必要なアプリケーションでは、
69 \fBgetpagesize\fP() ではなく \fIsysconf(_SC_PAGESIZE)\fP を利用すべきである。
70 .PP
71 .in +4n
72 .nf
73 #include <unistd.h>
74 long sz = sysconf(_SC_PAGESIZE);
75 .fi
76 .in
77
78 (ほとんどのシステムでは \fB_SC_PAGESIZE\fP の同義語として
79 \fB_SC_PAGE_SIZE\fP を使用することができる。)
80
81 \fBgetpagesize\fP()  が Linux のシステムコールとして存在するかどうかは、そのアーキテクチャに 依存している。
82 システムコールとして存在する場合には、カーネルシンボルの \fBPAGE_SIZE\fP を返す。 \fBPAGE_SIZE\fP
83 の値は、アーキテクチャとマシンモデルに依存する。 一般に、バイナリは、アーキテクチャごとに1つのバイナリ配布で済ませるために、
84 アーキテクチャには依存しているがマシンモデルには依存していない。 つまり、ユーザプログラムはコンパイル時にヘッダーファイルから \fBPAGE_SIZE\fP
85 を見つけて使用すべきではない。 少なくとも、マシンモデルについても依存性が存在する (sun4 のような)
86 アーキテクチャにおいては本物のシステムコールを使用する必要がある。 尚、 libc4, libc5, glibc 2.0 では、
87 \fBgetpagesize\fP()  がシステム・コールを使用せず、固定の値を返すために、この方法は 失敗する。glibc 2.1 では大丈夫である。
88 .SH 関連項目
89 \fBmmap\fP(2), \fBsysconf\fP(3)
90 .SH この文書について
91 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部
92 である。プロジェクトの説明とバグ報告に関する情報は
93 http://www.kernel.org/doc/man\-pages/ に書かれている。