1 .\" Copyright (C) 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\" and Copyright (C) 2005, Michael Kerrisk <mtk.manpages@gmail.com>
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.
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.
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
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" References consulted:
25 .\" Linux libc source code
26 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
28 .\" Modified Sat Jul 24 18:05:30 1993 by Rik Faith <faith@cs.unc.edu>
29 .\" Modified Fri Feb 16 14:25:17 1996 by Andries Brouwer <aeb@cwi.nl>
30 .\" Modified Sun Jul 21 20:55:44 1996 by Andries Brouwer <aeb@cwi.nl>
31 .\" Modified Mon Oct 15 21:16:25 2001 by John Levon <moz@compsoc.man.ac.uk>
32 .\" Modified Tue Oct 16 00:04:43 2001 by Andries Brouwer <aeb@cwi.nl>
33 .\" Modified Fri Jun 20 03:04:30 2003 by Andries Brouwer <aeb@cwi.nl>
34 .\" 2005-12-13, mtk, Substantial rewrite of strerror_r() description
35 .\" Addition of extra material on portability and standards.
37 .\" Japanese Version Copyright (c) 1997 YOSHINO Takashi
38 .\" all rights reserved.
39 .\" Translated 1997-01-20, YOSHINO Takashi <yoshino@civil.jcn.nihon-u.ac.jp>
40 .\" Updated & Modified 2001-11-03, Yuichi SATO <ysato@h4.dion.ne.jp>
41 .\" Updated 2005-12-26, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
42 .\" Updated 2007-09-06, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.64
44 .\"WORD GNU-specific GNU 仕様の
45 .\"WORD XSI-compliant XSI 準拠の
47 .TH STRERROR 3 2009-03-30 "" "Linux Programmer's Manual"
50 .\"O strerror, strerror_r \- return string describing error number
51 strerror, strerror_r \- エラー番号を説明する文字列を返す。
55 .B #include <string.h>
57 .BI "char *strerror(int " errnum );
59 .BI "char *strerror_r(int " errnum ", char *" buf ", size_t " buflen );
63 .\"O Feature Test Macro Requirements for glibc (see
64 .\"O .BR feature_test_macros (7)):
66 .RB ( feature_test_macros (7)
70 .\"O The XSI-compliant version of
71 .\"O .BR strerror_r ()
78 (_POSIX_C_SOURCE\ >=\ 200112L || _XOPEN_SOURCE\ >=\ 600) && !\ _GNU_SOURCE
83 .\"O function returns a pointer to a string that describes the error
84 .\"O code passed in the argument \fIerrnum\fP, possibly using the
86 .\"O part of the current locale to select the appropriate language.
87 .\"O This string must not be modified by the application, but may be
88 .\"O modified by a subsequent call to \fBperror\fP(3) or
90 .\"O No library function will modify this string.
93 関数は、引き数 \fIerrnum\fP で渡されたエラーコードについての
95 可能であるならば、適切な言語を選択するために、
99 この文字列は、アプリケーションで変更してはならないが、
106 この文字列を変更するライブラリ関数はない。
109 .\"O .BR strerror_r ()
110 .\"O function is similar to
111 .\"O .BR strerror (),
114 .\"O This function is available in two versions:
115 .\"O an XSI-compliant version specified in POSIX.1-2001
116 .\"O (available since glibc 2.3.4),
117 .\"O and a GNU-specific version (available since glibc 2.0).
118 .\"O The XSI-compliant version is provided with the feature test macros
119 .\"O settings shown in the SYNOPSIS;
120 .\"O otherwise the GNU-specific version is provided.
127 POSIX.1-2001 で規定された XSI 準拠のバージョン
128 (glibc 2.3.4 以降で利用可能) と、
129 GNU 仕様のバージョン (glibc 2.0 以降で利用可能) である。
130 「書式」の節に記載された機能検査マクロの場合には、
132 それ以外の場合には GNU 仕様のバージョンが提供される。
133 .\"O If no feature test macros are explicitly defined,
134 .\"O then (since glibc 2.4)
135 .\"O .B _POSIX_SOURCE
136 .\"O is defined by default with the value
137 .\"O 200112L, so that the XSI-compliant version of
138 .\"O .BR strerror_r ()
139 .\"O is provided by default.
140 機能検査マクロが一つも明示的に定義されない場合、
141 (glibc 2.4 以降では) デフォルトで
143 は値 200112l で定義され、その結果
148 .\"O The XSI-compliant
149 .\"O .BR strerror_r ()
150 .\"O is preferred for portable applications.
151 .\"O It returns the error string in the user-supplied buffer
165 .\"O The GNU-specific
166 .\"O .BR strerror_r ()
167 .\"O returns a pointer to a string containing the error message.
168 .\"O This may be either a pointer to a string that the function stores in
170 .\"O or a pointer to some (immutable) static string
174 .\"O If the function stores a string in
178 .\"O bytes are stored (the string may be truncated if
180 .\"O is too small) and the string always includes a terminating null byte.
183 は、エラーメッセージを格納した文字列へのポインタを返す。
187 何らかの (不変な) 静的な文字列へのポインタ、のいずれかとなる
197 が小さ過ぎたときには文字列は切り詰められる)、
199 .\"O .SH "RETURN VALUE"
204 .\"O .BR strerror_r ()
205 .\"O functions return
206 .\"O the appropriate error description string,
207 .\"O or an "Unknown error nnn" message if the error number is unknown.
212 文字列を返す。エラー番号が未知の場合は "Unknown error nnn" という
215 .\"O The XSI-compliant
216 .\"O .BR strerror_r ()
217 .\"O function returns 0 on success;
218 .\"O on error, \-1 is returned and
220 .\"O is set to indicate the error.
233 .\"O is not a valid error number.
238 .\"O Insufficient storage was supplied to contain the error description string.
239 エラーコードを説明する文字列のために、充分な領域が確保できなかった。
240 .\"O .SH "CONFORMING TO"
243 .\"O is specified by POSIX.1-2001, C89, C99.
244 .\"O .BR strerror_r ()
245 .\"O is specified by POSIX.1-2001.
247 は POSIX.1-2001, C89, C99 で規定されている。
249 は POSIX.1-2001 で規定されている。
251 .\"O The GNU-specific
252 .\"O .BR strerror_r ()
253 .\"O function is a nonstandard extension.
258 .\"O POSIX.1-2001 permits
262 .\"O if the call encounters an error, but does not specify what
263 .\"O value should be returned as the function result in the event of an error.
264 .\"O On some systems,
265 .\"O .\" e.g., Solaris 8, HP-UX 11
267 .\"O returns NULL if the error number is unknown.
268 .\"O On other systems,
269 .\"O .\" e.g., FreeBSD 5.4, Tru64 5.1B
271 .\"O returns a string something like "Error nnn occurred" and sets
275 .\"O if the error number is unknown.
280 をセットすることを認めているが、エラー発生時に関数の結果として
283 .\" 例えば Solaris 8, HP-UX 11
288 .\" 例えば FreeBSD 5.4, Tru64 5.1B
291 は "Error nnn occurred" といった文字列を返し、