OSDN Git Service

(split) LDP: draft snapshot generated from latest pthread/ja.po files.
[linuxjm/LDP_man-pages.git] / release / man3 / end.3
1 .\" Copyright (c) 2008, Linux Foundation, written by by Michael Kerrisk
2 .\"     <mtk.manpages@gmail.com>
3 .\"
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.
24 .\"
25 .\" Japanese Version Copyright (c) 2008  Akihiro MOTOKI
26 .\"         all rights reserved.
27 .\" Translated 2008-08-21, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.05
28 .\" 
29 .TH END 3 2008-07-17 "GNU" "Linux Programmer's Manual"
30 .SH 名前
31 etext, edata, end \- プログラムセグメントの終わり
32 .SH 書式
33 .nf
34 .BI extern " etext" ;
35 .BI extern " edata" ;
36 .BI extern " end" ;
37 .fi
38 .SH 説明
39 これらのシンボルのアドレスは各種のプログラムセグメントの終わりを示す。
40 .TP
41 .I etext
42 テキストセグメント (プログラムのコード) の末尾の次のアドレス。
43 .TP
44 .I edata
45 初期化されたデータのセグメントの末尾の次のアドレス。
46 .TP
47 .I end
48 初期化されていないデータのセグメント (BSS セグメントとも言われる)
49 の末尾の次のアドレス。
50 .SH 準拠
51 これらのシンボルは長年ほとんどの UNIX システムで提供されているが、
52 標準化されてはいない。注意して使うこと。
53 .SH 注意
54 プログラムではこれらのシンボルは明示的に宣言しなければならない。
55 これらはどのヘッダファイルでも定義されていない。
56
57 いくつかのシステムでは、これらのシンボルの名前は前にアンダースコアが
58 付いていて、
59 .IR _etext ,
60 .IR _edata ,
61 .I _end
62 となっている。
63 Linux でコンパイルされたプログラムでは、
64 これらのシンボルでも定義される。
65
66 プログラムの実行開始時に、プログラム・ブレークは
67 .I &end
68 の近くのどこか (おそらく次のページの先頭) になる。
69 しかしながら、
70 .BR brk (2)
71
72 .BR malloc (3)
73 でメモリが割り当てられるに連れて、プログラム・ブレークは変化していく。
74 引き数に 0 を指定して
75 .BR sbrk (2)
76 を呼び出すことで、プログラム・ブレークの現在値を知ることができる。
77 .SH 例
78 下記のプログラムを実行すると、次のような出力が得られる。
79 .in +4n
80 .nf
81
82 .RB "$" " ./a.out"
83 First address past:
84     program text (etext)       0x8048568
85     initialized data (edata)   0x804a01c
86     uninitialized data (end)   0x804a024
87 .fi
88 .SS プログラムのソース
89 \&
90 .in
91 .nf
92 #include <stdio.h>
93 #include <stdlib.h>
94
95 extern char etext, edata, end; /* The symbols must have some type,
96                                    or "gcc \-Wall" complains */
97
98 int
99 main(int argc, char *argv[])
100 {
101     printf("First address past:\\n");
102     printf("    program text (etext)      %10p\\n", &etext);
103     printf("    initialized data (edata)  %10p\\n", &edata);
104     printf("    uninitialized data (end)  %10p\\n", &end);
105
106     exit(EXIT_SUCCESS);
107 }
108 .fi
109 .SH 関連項目
110 .BR objdump (1),
111 .BR readelf (1),
112 .BR sbrk (2),
113 .BR elf (5)