OSDN Git Service

1ccf6c54fc0c13303a9539154ee3b976fd3cbb0b
[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 .\"
31 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
32 .\"         all rights reserved.
33 .\" Translated 2002-04-14, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
34 .\" Updated 2003-07-03, Akihiro Motoki <amotoki@dd.iij4u.or.jp>
35 .\" Updated 2007-01-07, Akihiro MOTOKI, catch up to LDP v2.43
36 .\" Updated 2012-04-30, Akihiro MOTOKI <amotoki@gmail.com>
37 .\"
38 .TH GETPAGESIZE 2 2010\-11\-16 Linux "Linux Programmer's Manual"
39 .SH 名前
40 getpagesize \- メモリのページ・サイズを取得する
41 .SH 書式
42 \fB#include <unistd.h>\fP
43 .sp
44 \fBint getpagesize(void);\fP
45 .sp
46 .in -4n
47 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
48 .in
49 .sp
50 \fBgetpagesize\fP():
51 .ad l
52 .RS 4
53 .PD 0
54 .TP  4
55 glibc 2.12 以降:
56 .nf
57 _BSD_SOURCE ||
58     !(_POSIX_C_SOURCE\ >=\ 200112L || _XOPEN_SOURCE\ >=\ 600)
59 .TP  4
60 .fi
61 glibc 2.12 より前: _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
62 .PD
63 .RE
64 .ad b
65 .SH 説明
66 .\" .SH HISTORY
67 .\" This call first appeared in 4.2BSD.
68 \fBgetpagesize\fP() 関数はメモリページの大きさをバイト数で返す。
69 ここでいう「ページ」は固定長のブロックであり、
70 \fBmmap\fP(2) で実行されるメモリ割り当てとファイルマッピングの単位である。
71 .SH 準拠
72 SVr4, 4.4BSD, SUSv2.
73 SUSv2 では \fBgetpagesize\fP() システムコールは「過去の遺物 (LEGACY)」とされており、
74 POSIX.1\-2001 からは外されている。 HP\-UX にはこのシステムコールは存在しない。
75 .SH 注意
76 移植性が必要なアプリケーションでは、
77 \fBgetpagesize\fP() ではなく \fIsysconf(_SC_PAGESIZE)\fP を利用すべきである。
78 .PP
79 .in +4n
80 .nf
81 #include <unistd.h>
82 long sz = sysconf(_SC_PAGESIZE);
83 .fi
84 .in
85
86 (ほとんどのシステムでは \fB_SC_PAGESIZE\fP の同義語として
87 \fB_SC_PAGE_SIZE\fP を使用することができる。)
88
89 \fBgetpagesize\fP()  が Linux のシステムコールとして存在するかどうかは、そのアーキテクチャに 依存している。
90 システムコールとして存在する場合には、カーネルシンボルの \fBPAGE_SIZE\fP を返す。 \fBPAGE_SIZE\fP
91 の値は、アーキテクチャとマシンモデルに依存する。 一般に、バイナリは、アーキテクチャごとに1つのバイナリ配布で済ませるために、
92 アーキテクチャには依存しているがマシンモデルには依存していない。 つまり、ユーザプログラムはコンパイル時にヘッダーファイルから \fBPAGE_SIZE\fP
93 を見つけて使用すべきではない。 少なくとも、マシンモデルについても依存性が存在する (sun4 のような)
94 アーキテクチャにおいては本物のシステムコールを使用する必要がある。 尚、 libc4, libc5, glibc 2.0 では、
95 \fBgetpagesize\fP()  がシステム・コールを使用せず、固定の値を返すために、この方法は 失敗する。glibc 2.1 では大丈夫である。
96 .SH 関連項目
97 \fBmmap\fP(2), \fBsysconf\fP(3)
98 .SH この文書について
99 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.54 の一部
100 である。プロジェクトの説明とバグ報告に関する情報は
101 http://www.kernel.org/doc/man\-pages/ に書かれている。