OSDN Git Service

(split) LDP: Translation snapshots for ja.po.
[linuxjm/LDP_man-pages.git] / draft / man3 / perror.3
1 .\" Copyright (c) 1994 Michael Haardt (michael@moria.de), 1994-06-04
2 .\" Copyright (c) 1995 Michael Haardt
3 .\"      (michael@cantor.informatik.rwth-aachen.de), 1995-03-16
4 .\" Copyright (c) 1996 Andries Brouwer (aeb@cwi.nl), 1996-01-13
5 .\"
6 .\" This is free documentation; you can redistribute it and/or
7 .\" modify it under the terms of the GNU General Public License as
8 .\" published by the Free Software Foundation; either version 2 of
9 .\" the License, or (at your option) any later version.
10 .\"
11 .\" The GNU General Public License's references to "object code"
12 .\" and "executables" are to be interpreted as the output of any
13 .\" document formatting or typesetting system, including
14 .\" intermediate and printed output.
15 .\"
16 .\" This manual is distributed in the hope that it will be useful,
17 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
18 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 .\" GNU General Public License for more details.
20 .\"
21 .\" You should have received a copy of the GNU General Public
22 .\" License along with this manual; if not, write to the Free
23 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
24 .\" USA.
25 .\"
26 .\" 1996-01-13 aeb: merged in some text contributed by Melvin Smith
27 .\"   (msmith@falcon.mercer.peachnet.edu) and various other changes.
28 .\" Modified 1996-05-16 by Martin Schulze (joey@infodrom.north.de)
29 .\"
30 .\" Japanese Version Copyright (c) 1998 TACHIBANA Akira
31 .\"         all rights reserved.
32 .\" Translated 1998-05-28, TACHIBANA Akira <tati@tky.3web.ne.jp>
33 .\" Updated 2001-12-21, Kentaro Shirakata <argrath@ub32.org>
34 .\" Updated 2005-03-15, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
35 .\"
36 .TH PERROR 3 2007-07-26 "" "Linux Programmer's Manual"
37 .\"O .SH NAME
38 .SH 名前
39 .\"O perror \- print a system error message
40 perror \- システムエラーメッセージを出力する
41 .\"O .SH SYNOPSIS
42 .SH 書式
43 .B #include <stdio.h>
44 .sp
45 .BI "void perror(const char *" s );
46 .sp
47 .B #include <errno.h>
48 .sp
49 .BI "const char *" sys_errlist [];
50 .br
51 .BI "int " sys_nerr ;
52 .br
53 .BI "int " errno ;
54 .sp
55 .in -4n
56 .\"O Feature Test Macro Requirements for glibc (see
57 .\"O .BR feature_test_macros (7)):
58 glibc 向けの機能検査マクロの要件
59 .RB ( feature_test_macros (7)
60 参照):
61 .in
62 .sp
63 .IR sys_errlist ,
64 .IR sys_nerr :
65 _BSD_SOURCE
66 .\"O .SH DESCRIPTION
67 .SH 説明
68 .\"O The routine
69 .\"O .BR perror ()
70 .\"O produces a message on the standard error output, describing the last
71 .\"O error encountered during a call to a system or library function.
72 関数
73 .BR perror ()
74 は、システムコールやライブラリ関数の呼び出しにおいて、最後に発生した
75 エラーに関する説明メッセージを生成し、標準エラー出力に出力する。
76 .\"O First (if
77 .\"O .I s
78 .\"O is not NULL and
79 .\"O .I *s
80 .\"O is not a null byte (\(aq\\0\(aq)) the argument string
81 .\"O .I s
82 .\"O is printed, followed by a colon and a blank.
83 .\"O Then the message and a new-line.
84 .RI ( s
85 が NULL でなく、
86 .I *s
87 が NULL バイト (\(aq\\0\(aq) でない場合には) 引き数の文字列
88 .I s
89 がまず出力され、続いてコロン、空白が出力され、
90 それからメッセージと改行が出力される。
91
92 .\"O To be of most use, the argument string should include the name
93 .\"O of the function that incurred the error.
94 .\"O The error number is taken from
95 .\"O the external variable
96 .\"O .IR errno ,
97 .\"O which is set when errors occur but not
98 .\"O cleared when successful calls are made.
99 このメッセージを最大限活用するためには、引き数文字列にエラーが発生した
100 関数名を入れておくとよい。
101 エラー番号は外部変数
102 .I errno
103 から取得される。
104 .I errno
105 はエラーが発生した時に設定され、
106 成功した呼び出しではクリアされない。
107
108 .\"O The global error list
109 .\"O .IR sys_errlist "[]"
110 .\"O indexed by
111 .\"O .I errno
112 .\"O can be used to obtain the error message without the newline.
113 .\"O The largest message number provided in the table is
114 .\"O .IR sys_nerr " \-1."
115 .\"O Be careful when directly accessing this list because new error values
116 .\"O may not have been added to
117 .\"O .IR sys_errlist "[]."
118 大域変数のエラーリスト
119 .IR sys_errlist "[]"
120
121 .I errno
122 を添字とする配列で、この配列から改行無しのエラーメッセージが取得される。
123 テーブルでの最大のメッセージ番号は
124 .IR sys_nerr " \-1"
125 となる。
126 このテーブルを直接参照する際には注意すること。なぜなら、新しいエラー番号が
127 .IR sys_errlist "[]"
128 に追加済とは限らないからである。
129
130 .\"O When a system call fails, it usually returns \-1 and sets the
131 .\"O variable
132 .\"O .I errno
133 .\"O to a value describing what went wrong.
134 .\"O (These values can be found in
135 .\"O .IR <errno.h> .)
136 .\"O Many library functions do likewise.
137 システムコールが失敗した場合、通常、返り値として \-1 が返り、
138 .I errno
139 にエラーを識別する値が設定される (設定されるエラー番号は
140 .I <errno.h>
141 に記載されている)。
142 多くのライブラリ関数も同様の動作となる。
143 .\"O The function
144 .\"O .BR perror ()
145 .\"O serves to translate this error code into human-readable form.
146 .\"O Note that
147 .\"O .I errno
148 .\"O is undefined after a successful library call:
149 .\"O this call may well change this variable, even though it succeeds,
150 .\"O for example because it internally used some other library function that failed.
151 関数
152 .BR perror ()
153 は、このエラーコードの可読なメッセージへの変換を行う。
154 .I errno
155 は、ライブラリ呼び出しが成功した後には未定義であることに注意が必要である:
156 その呼び出し自身は成功したとしても、内部で呼び出した他のライブラリ関数が
157 失敗して、その結果をこの変数に設定することがあるからだ。
158 .\"O Thus, if a failing call is not immediately followed by a call to
159 .\"O .BR perror (),
160 .\"O the value of
161 .\"O .I errno
162 .\"O should be saved.
163 よって、失敗した呼び出しの直後に
164 .BR perror ()
165 を呼ばない場合には
166 .I errno
167 の値を
168 保存しておかなければならない。
169 .\"O .SH "CONFORMING TO"
170 .SH 準拠
171 .\"O The function
172 .\"O .BR perror ()
173 .\"O and the external
174 .\"O .I errno
175 .\"O (see
176 .\"O .BR errno (3))
177 .\"O conform to C89, C99, 4.3BSD, POSIX.1-2001.
178 .\"O The externals
179 .\"O .I sys_nerr
180 .\"O and
181 .\"O .I sys_errlist
182 .\"O conform to BSD.
183 関数
184 .BR perror ()
185 と外部変数
186 .I errno
187 .RB ( errno (3)
188 参照) は C89, 4.3BSD, POSIX.1-2001 に準拠している。
189 外部変数
190 .I sys_nerr
191
192 .I sys_errlist
193 は BSD に準拠している。
194 .\"O .SH NOTES
195 .SH 注意
196 .\"O The externals
197 .\"O .I sys_nerr
198 .\"O and
199 .\"O .I sys_errlist
200 .\"O are defined by glibc, but in
201 .\"O .IR <stdio.h> .
202 外部変数
203 .I sys_nerr
204
205 .I sys_errlist
206 は glibc で定義されているが、
207 .I <stdio.h>
208 に含まれている。
209 .\"O .\" and only when _BSD_SOURCE is defined.
210 .\"O .\" When
211 .\"O .\" .B _GNU_SOURCE
212 .\"O .\" is defined, the symbols
213 .\"O .\" .I _sys_nerr
214 .\"O .\" and
215 .\"O .\" .I _sys_errlist
216 .\"O .\" are provided.
217 .\" .B _BSD_SOURCE
218 .\" が定義された場合にのみ、これらの変数は定義される。
219 .\" .B _GNU_SOURCE
220 .\" が定義された場合は、
221 .\" .I _sys_nerr
222 .\" と
223 .\" .I _sys_errlist
224 .\" というシンボルが提供される。
225 .\"O .SH "SEE ALSO"
226 .SH 関連項目
227 .BR err (3),
228 .BR errno (3),
229 .BR error (3),
230 .BR strerror (3)