OSDN Git Service

(split) LDP: Release pages for LDP v3.39.
[linuxjm/LDP_man-pages.git] / release / man3 / end.3
1 .\" Copyright (c) 2008, Linux Foundation, written 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 .\"*******************************************************************
26 .\"
27 .\" This file was generated with po4a. Translate the source file.
28 .\"
29 .\"*******************************************************************
30 .TH END 3 2008\-07\-17 GNU "Linux Programmer's Manual"
31 .SH 名前
32 etext, edata, end \- プログラムセグメントの終わり
33 .SH 書式
34 .nf
35 \fBextern\fP\fI etext\fP\fB;\fP
36 \fBextern\fP\fI edata\fP\fB;\fP
37 \fBextern\fP\fI end\fP\fB;\fP
38 .fi
39 .SH 説明
40 これらのシンボルのアドレスは各種のプログラムセグメントの終わりを示す。
41 .TP 
42 \fIetext\fP
43 テキストセグメント (プログラムのコード) の末尾の次のアドレス。
44 .TP 
45 \fIedata\fP
46 初期化されたデータのセグメントの末尾の次のアドレス。
47 .TP 
48 \fIend\fP
49 初期化されていないデータのセグメント (BSS セグメントとも言われる)  の末尾の次のアドレス。
50 .SH 準拠
51 これらのシンボルは長年ほとんどの UNIX システムで提供されているが、 標準化されてはいない。注意して使うこと。
52 .SH 注意
53 プログラムではこれらのシンボルは明示的に宣言しなければならない。 これらはどのヘッダファイルでも定義されていない。
54
55 いくつかのシステムでは、これらのシンボルの名前は前にアンダースコアが 付いていて、 \fI_etext\fP, \fI_edata\fP, \fI_end\fP
56 となっている。 Linux でコンパイルされたプログラムでは、 これらのシンボルでも定義される。
57
58 プログラムの実行開始時に、プログラム・ブレークは \fI&end\fP の近くのどこか (おそらく次のページの先頭) になる。 しかしながら、
59 \fBbrk\fP(2)  や \fBmalloc\fP(3)  でメモリが割り当てられるに連れて、プログラム・ブレークは変化していく。 引き数に 0 を指定して
60 \fBsbrk\fP(2)  を呼び出すことで、プログラム・ブレークの現在値を知ることができる。
61 .SH 例
62 下記のプログラムを実行すると、次のような出力が得られる。
63 .in +4n
64 .nf
65
66 $\fB ./a.out\fP
67 First address past:
68     program text (etext)       0x8048568
69     initialized data (edata)   0x804a01c
70     uninitialized data (end)   0x804a024
71 .fi
72 .in
73 .SS プログラムのソース
74 \&
75 .nf
76 #include <stdio.h>
77 #include <stdlib.h>
78
79 extern char etext, edata, end; /* The symbols must have some type,
80                                    or "gcc \-Wall" complains */
81
82 int
83 main(int argc, char *argv[])
84 {
85     printf("First address past:\en");
86     printf("    program text (etext)      %10p\en", &etext);
87     printf("    initialized data (edata)  %10p\en", &edata);
88     printf("    uninitialized data (end)  %10p\en", &end);
89
90     exit(EXIT_SUCCESS);
91 }
92 .fi
93 .SH 関連項目
94 \fBobjdump\fP(1), \fBreadelf\fP(1), \fBsbrk\fP(2), \fBelf\fP(5)