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)):
65 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
66 .RB ( feature_test_macros (7)
70 .\"O The XSI-compliant version of
71 .\"O .BR strerror_r ()
74 XSI ½àµò¤Î¥Ð¡¼¥¸¥ç¥ó¤Î
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 ¤ÇÅϤµ¤ì¤¿¥¨¥é¡¼¥³¡¼¥É¤Ë¤Ä¤¤¤Æ¤Î
94 ÀâÌÀ¤¬Æþ¤Ã¤¿Ê¸»úÎó¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£
95 ²Äǽ¤Ç¤¢¤ë¤Ê¤é¤Ð¡¢Å¬ÀڤʸÀ¸ì¤òÁªÂò¤¹¤ë¤¿¤á¤Ë¡¢
99 ¤³¤Îʸ»úÎó¤Ï¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ÇÊѹ¹¤·¤Æ¤Ï¤Ê¤é¤Ê¤¤¤¬¡¢
105 Êѹ¹¤µ¤ì¤Æ¤â¹½¤ï¤Ê¤¤¡£
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.
125 ¥¹¥ì¥Ã¥É¥»¡¼¥Õ¤Ç¤¢¤ë¡£
126 ¤³¤Î´Ø¿ô¤Ë¤ÏÆó¼ïÎà¤Î¥Ð¡¼¥¸¥ç¥ó¤¬Â¸ºß¤·¡¢
127 POSIX.1-2001 ¤Çµ¬Äꤵ¤ì¤¿ XSI ½àµò¤Î¥Ð¡¼¥¸¥ç¥ó
128 (glibc 2.3.4 °Ê¹ß¤ÇÍøÍѲÄǽ) ¤È¡¢
129 GNU »ÅÍͤΥС¼¥¸¥ç¥ó (glibc 2.0 °Ê¹ß¤ÇÍøÍѲÄǽ) ¤Ç¤¢¤ë¡£
130 ¡Ö½ñ¼°¡×¤ÎÀá¤ËµºÜ¤µ¤ì¤¿µ¡Ç½¸¡ºº¥Þ¥¯¥í¤Î¾ì¹ç¤Ë¤Ï¡¢
131 XSI ½àµò¤Î¥Ð¡¼¥¸¥ç¥ó¤¬Ä󶡤µ¤ì¤ë¡£
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 ¤ÇÄêµÁ¤µ¤ì¡¢¤½¤Î·ë²Ì
144 XSI ½àµò¤Î¥Ð¡¼¥¸¥ç¥ó¤Î
146 ¤¬¥Ç¥Õ¥©¥ë¥È¤ÇÄ󶡤µ¤ì¤ë¡£
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
155 °Ü¿¢À¤¬É¬Íפʥ¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç¤Ï¡¢
159 ¤³¤Î´Ø¿ô¤Ï¡¢¥æ¡¼¥¶¡¼¤«¤éÄ󶡤µ¤ì¤ëŤµ
163 ¤Ë¥¨¥é¡¼Ê¸»úÎó¤òÊÖ¤¹¡£
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 ¤Ï¡¢¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤ò³ÊǼ¤·¤¿Ê¸»úÎó¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£
186 ¤Ë³ÊǼ¤·¤¿Ê¸»úÎó¤Ø¤Î¥Ý¥¤¥ó¥¿¤«¡¢
187 ²¿¤é¤«¤Î (ÉÔÊѤÊ) ÀÅŪ¤Êʸ»úÎó¤Ø¤Î¥Ý¥¤¥ó¥¿¡¢¤Î¤¤¤º¤ì¤«¤È¤Ê¤ë
192 ¤Ëʸ»úÎ󤬳ÊǼ¤µ¤ì¤ë¾ì¹ç¤Ï¡¢
197 ¤¬¾®¤µ²á¤®¤¿¤È¤¤Ë¤Ïʸ»úÎó¤ÏÀÚ¤êµÍ¤á¤é¤ì¤ë)¡¢
198 ʸ»úÎó¤Ë¤Ïɬ¤º½ªÃ¼¥Ì¥ëʸ»ú¤¬´Þ¤Þ¤ì¤ë¡£
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.
211 ¤Ï¥¨¥é¡¼ÆâÍƤòÀâÌÀ¤¹¤ë
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.
223 ´Ø¿ô¤ÏÀ®¸ù¤¹¤ë¤È 0 ¤òÊÖ¤¹¡£
224 ¥¨¥é¡¼¤Î¾ì¹ç¤Ë¤Ï¡¢ \-1 ¤òÊÖ¤·¡¢
226 ¤Ë¥¨¥é¡¼ÆâÍƤò¼¨¤¹Ãͤò¥»¥Ã¥È¤¹¤ë¡£
233 .\"O is not a valid error number.
235 ¤ÎÃͤ¬Í¸ú¤Ê¥¨¥é¡¼ÈÖ¹æ¤Ç¤Ï¤Ê¤¤¡£
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.
256 ´Ø¿ô¤ÏÈóɸ½à¤Î³ÈÄ¥¤Ç¤¢¤ë¡£
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.
278 ¤¬¥¨¥é¡¼¤ËÁø¶ø¤·¤¿¾ì¹ç¤Ë
280 ¤ò¥»¥Ã¥È¤¹¤ë¤³¤È¤òǧ¤á¤Æ¤¤¤ë¤¬¡¢¥¨¥é¡¼È¯À¸»þ¤Ë´Ø¿ô¤Î·ë²Ì¤È¤·¤Æ
281 ¤É¤ó¤ÊÃͤòÊÖ¤¹¤Ù¤¤«¤òµ¬Äꤷ¤Æ¤Ê¤¤¡£
283 .\" Î㤨¤Ð Solaris 8, HP-UX 11
284 ¥¨¥é¡¼Èֹ椬̤ÃΤξì¹ç¡¢
288 .\" Î㤨¤Ð FreeBSD 5.4, Tru64 5.1B
289 ¥¨¥é¡¼Èֹ椬̤ÃΤξì¹ç¡¢
291 ¤Ï "Error nnn occurred" ¤È¤¤¤Ã¤¿Ê¸»úÎó¤òÊÖ¤·¡¢