OSDN Git Service

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