OSDN Git Service

486e40585e334ab057c28dad4775151cd38c4d2d
[linuxjm/LDP_man-pages.git] / draft / man3 / end.3
1 .\" Copyright (c) 2008, Linux Foundation, written by Michael Kerrisk
2 .\"     <mtk.manpages@gmail.com>
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
26 .\"*******************************************************************
27 .\"
28 .\" This file was generated with po4a. Translate the source file.
29 .\"
30 .\"*******************************************************************
31 .TH END 3 2008\-07\-17 GNU "Linux Programmer's Manual"
32 .SH 名前
33 etext, edata, end \- プログラムセグメントの終わり
34 .SH 書式
35 .nf
36 \fBextern\fP\fI etext\fP\fB;\fP
37 \fBextern\fP\fI edata\fP\fB;\fP
38 \fBextern\fP\fI end\fP\fB;\fP
39 .fi
40 .SH 説明
41 これらのシンボルのアドレスは各種のプログラムセグメントの終わりを示す。
42 .TP 
43 \fIetext\fP
44 テキストセグメント (プログラムのコード) の末尾の次のアドレス。
45 .TP 
46 \fIedata\fP
47 初期化されたデータのセグメントの末尾の次のアドレス。
48 .TP 
49 \fIend\fP
50 初期化されていないデータのセグメント (BSS セグメントとも言われる)  の末尾の次のアドレス。
51 .SH 準拠
52 これらのシンボルは長年ほとんどの UNIX システムで提供されているが、 標準化されてはいない。注意して使うこと。
53 .SH 注意
54 プログラムではこれらのシンボルは明示的に宣言しなければならない。 これらはどのヘッダファイルでも定義されていない。
55
56 いくつかのシステムでは、これらのシンボルの名前は前にアンダースコアが 付いていて、 \fI_etext\fP, \fI_edata\fP, \fI_end\fP
57 となっている。 Linux でコンパイルされたプログラムでは、 これらのシンボルでも定義される。
58
59 プログラムの実行開始時に、プログラム・ブレークは \fI&end\fP の近くのどこか (おそらく次のページの先頭) になる。 しかしながら、
60 \fBbrk\fP(2)  や \fBmalloc\fP(3)  でメモリが割り当てられるに連れて、プログラム・ブレークは変化していく。 引き数に 0 を指定して
61 \fBsbrk\fP(2)  を呼び出すことで、プログラム・ブレークの現在値を知ることができる。
62 .SH 例
63 下記のプログラムを実行すると、次のような出力が得られる。
64 .in +4n
65 .nf
66
67 $\fB ./a.out\fP
68 First address past:
69     program text (etext)       0x8048568
70     initialized data (edata)   0x804a01c
71     uninitialized data (end)   0x804a024
72 .fi
73 .in
74 .SS プログラムのソース
75 \&
76 .nf
77 #include <stdio.h>
78 #include <stdlib.h>
79
80 extern char etext, edata, end; /* The symbols must have some type,
81                                    or "gcc \-Wall" complains */
82
83 int
84 main(int argc, char *argv[])
85 {
86     printf("First address past:\en");
87     printf("    program text (etext)      %10p\en", &etext);
88     printf("    initialized data (edata)  %10p\en", &edata);
89     printf("    uninitialized data (end)  %10p\en", &end);
90
91     exit(EXIT_SUCCESS);
92 }
93 .fi
94 .SH 関連項目
95 \fBobjdump\fP(1), \fBreadelf\fP(1), \fBsbrk\fP(2), \fBelf\fP(5)
96 .SH この文書について
97 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.52 の一部
98 である。プロジェクトの説明とバグ報告に関する情報は
99 http://www.kernel.org/doc/man\-pages/ に書かれている。