1 .\" Copyright (c) 1996 Andries Brouwer (aeb@cwi.nl)
3 .\" This is free documentation; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
8 .\" The GNU General Public License's references to "object code"
9 .\" and "executables" are to be interpreted as the output of any
10 .\" document formatting or typesetting system, including
11 .\" intermediate and printed output.
13 .\" This manual is distributed in the hope that it will be useful,
14 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
15 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 .\" GNU General Public License for more details.
18 .\" You should have received a copy of the GNU General Public
19 .\" License along with this manual; if not, write to the Free
20 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
23 .\" 5 Oct 2002, Modified by Michael Kerrisk <mtk.manpages@gmail.com>
24 .\" Updated for POSIX.1 2001
25 .\" 2004-12-17 Martin Schulze <joey@infodrom.org>, mtk
26 .\" Removed errno declaration prototype, added notes
27 .\" 2006-02-09 Kurt Wall, mtk
28 .\" Added non-POSIX errors
30 .\" Japanese Version Copyright (c) 1997 HIROFUMI Nishizuka
31 .\" all rights reserved.
32 .\" Translated 1997-12-24, HIROFUMI Nishizuka <nishi@rpts.cl.nec.co.jp>
33 .\" Updated 1999-03-01, NAKANO Takeo <nakano@apm.seikei.ac.jp>
34 .\" Updated 1999-08-21, NAKANO Takeo <nakano@apm.seikei.ac.jp>
35 .\" Updated 2003-07-03, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
36 .\" Updated 2005-03-15, Akihiro MOTOKI
37 .\" Updated 2006-02-15, Akihiro MOTOKI, Catch up to LDP v2.23
38 .\" Updated 2006-07-14, Akihiro MOTOKI, Catch up to LDP v2.34
39 .\" Updated 2008-08-07, Akihiro MOTOKI, Catch up to LDP v3.05
41 .TH ERRNO 3 2008-07-09 "" "Linux Programmer's Manual"
44 .\"O errno \- number of last error
45 errno \- 直近に発生したエラーの番号
50 .\".BI "extern int " errno ;
55 .\"O header file defines the integer variable
57 .\"O which is set by system calls and some library functions in the event
58 .\"O of an error to indicate what went wrong.
59 .\"O Its value is significant only when the return value of
60 .\"O the call indicated an error
61 .\"O (i.e., \-1 from most system calls;
62 .\"O \-1 or NULL from most library functions);
63 .\"O a function that succeeds
65 .\"O allowed to change
72 システムコールやいくつかのライブラリ関数は、エラーが発生した際に
74 この値は呼び出しの返り値がエラー (ほとんどのシステムコールでは
75 \-1 で、ほとんどのライブラリ関数では \-1 か NULL) を示したときに
76 のみ意味を持つが、ライブラリ関数は成功した場合も
80 .\"O Valid error numbers are all nonzero; \fIerrno\fP is never set to zero
81 .\"O by any system call or library function.
82 有効なエラー番号はいずれも 0 以外の値を持つ。
84 \fIerrno\fP を 0 に設定することはない。
86 .\"O For some system calls and library functions (e.g.,
87 .\"O .BR getpriority (2)),
88 .\"O \-1 is a valid return on success.
89 .\"O In such cases, a successful return can be distinguished from an error
90 .\"O return by setting
92 .\"O to zero before the call, and then,
93 .\"O if the call returns a status that indicates that an error
94 .\"O may have occurred, checking to see if
96 .\"O has a nonzero value.
97 いくつかのシステムコールやライブラリ関数 (例えば
99 では、成功した場合の有効な返り値として \-1 が返されることがある。
100 このような場合、成功なのかエラーなのかを区別するためには、
103 を 0 に設定しておけばよい。呼び出しの返り値がエラー発生の可能性を
108 .\"O \fIerrno\fP is defined by the ISO C standard to be a modifiable lvalue
109 .\"O of type \fIint\fP, and must not be explicitly declared; \fIerrno\fP
111 .\"O \fIerrno\fP is thread-local; setting it in one thread
112 .\"O does not affect its value in any other thread.
113 \fIerrno\fP は、ISO C standard で \fIint\fP 型の変更可能な左辺値
114 として定義されており、明示的に宣言を行ってはならない;
115 \fIerrno\fP はマクロの場合もありえる。
116 \fIerrno\fP はスレッド毎に値を持つ。
117 つまりあるスレッドで \fIerrno\fP が設定されても、
118 他のスレッドの \fIerrno\fP には影響しない。
120 .\"O All the error names specified by POSIX.1
121 .\"O must have distinct values, with the exception of
124 .\"O .BR EWOULDBLOCK ,
125 .\"O which may be the same.
126 POSIX.1 で定義されているすべてのエラー名には、
127 それぞれ異なる値が対応していなければならない。
134 .\" The following is now
135 .\"O .\" POSIX.1 (2001 edition) lists the following symbolic error names. Of
136 .\"O .\" these, \fBEDOM\fP and \fBERANGE\fP are in the ISO C standard. ISO C
137 .\"O .\" Amendment 1 defines the additional error number \fBEILSEQ\fP for
138 .\"O .\" coding errors in multibyte or wide characters.
139 .\" POSIX.1 (2001 年版) でのエラー名シンボルのリストを以下に示す。
140 .\" これらのうち、 \fBEDOM\fP と \fBERANGE\fP は ISO C standard にある。
141 .\" さらに、ISO C Amendment 1 では、エラー番号 \fBEILSEQ\fP が
142 .\" マルチバイト文字やワイド文字での符号化エラーを表すために
145 .\"O Below is a list of the symbolic error names that are defined on Linux.
146 .\"O Some of these are marked
148 .\"O indicating that the name is defined by POSIX.1-2001, or
150 .\"O indicating that the name is defined by C99.
153 .\"O Argument list too long (POSIX.1)
154 引き数リストが長過ぎる (POSIX.1)
157 .\"O Permission denied (POSIX.1)
161 .\"O Address already in use (POSIX.1)
162 アドレスがすでに使用されている (POSIX.1)
165 .\"O Address not available (POSIX.1)
166 アドレスが使用できない (POSIX.1)
167 .\"O .\" EADV is only an error on HURD(?)
168 .\" EADV は HURD においてだけのエラー(?)
171 .\"O Address family not supported (POSIX.1)
172 アドレス・ファミリーがサポートされていない (POSIX.1)
175 .\"O Resource temporarily unavailable (may be the same value as
176 .\"O .BR EWOULDBLOCK )
183 .\"O Connection already in progress (POSIX.1)
184 接続が既に処理中である (POSIX.1)
187 .\"O Invalid exchange
188 不正なやり取り (exchange) である
191 .\"O Bad file descriptor (POSIX.1)
192 ファイルディスクリプタが不正である (POSIX.1)
195 .\"O File descriptor in bad state
199 .\"O Bad message (POSIX.1)
200 メッセージが不正である (POSIX.1)
203 .\"O Invalid request descriptor
207 .\"O Invalid request code
213 .\" EBFONT is defined but appears not to be used by kernel or glibc.
216 .\"O Device or resource busy (POSIX.1)
217 リソースが使用中である (POSIX.1)
220 .\"O Operation canceled (POSIX.1)
221 操作がキャンセルされた (POSIX.1)
224 .\"O No child processes (POSIX.1)
228 .\"O Channel number out of range
232 .\"O Communication error on send
236 .\"O Connection aborted (POSIX.1)
240 .\"O Connection refused (POSIX.1)
244 .\"O Connection reset (POSIX.1)
248 .\"O Resource deadlock avoided (POSIX.1)
249 リソースのデッドロックを回避した (POSIX.1)
258 .\"O Destination address required (POSIX.1)
259 宛先アドレスが必要である (POSIX.1)
262 .\"O Mathematics argument out of domain of function (POSIX.1, C99)
263 数学関数で引き数が領域外である (out of domain)
264 .\" EDOTDOT is defined but appears to be unused
267 .\" POSIX just says "Reserved"
268 .\"O Disk quota exceeded (POSIX.1)
269 ディスク・クォータ (quota) を超過した (POSIX.1)
272 .\"O File exists (POSIX.1)
276 .\"O Bad address (POSIX.1)
280 .\"O File too large (POSIX.1)
288 .\"O Host is unreachable (POSIX.1)
289 ホストに到達不能である (POSIX.1)
292 .\"O Identifier removed (POSIX.1)
296 .\"O Illegal byte sequence (POSIX.1, C99)
297 不正なバイト列 (POSIX.1, C99)
300 .\"O Operation in progress (POSIX.1)
304 .\"O Interrupted function call (POSIX.1); see
306 関数呼び出しが割り込まれた (POSIX.1);
311 .\"O Invalid argument (POSIX.1)
315 .\"O Input/output error (POSIX.1)
319 .\"O Socket is connected (POSIX.1)
320 ソケットが接続されている (POSIX.1)
323 .\"O Is a directory (POSIX.1)
327 .\"O Is a named type file
335 .\"O Key was rejected by service
339 .\"O Key has been revoked
347 .\"O Level 2 not synchronized
359 .\"O Cannot access a needed shared library
360 必要な共有ライブラリにアクセスできなかった
363 .\"O Accessing a corrupted shared library
364 壊れた共有ライブラリにアクセスしようとした
367 .\"O Attempting to link in too many shared libraries
368 リンクしようとした共有ライブラリが多過ぎる
371 .\"O lib section in a.out corrupted
372 a.out のライブラリセクションが壊れている (corrupted)
375 .\"O Cannot exec a shared library directly
379 .\"O Too many levels of symbolic links (POSIX.1)
380 シンボリック・リンクの回数が多過ぎる (POSIX.1)
381 .\" ELNRNG is defined but appears to be unused
384 .\"O Wrong medium type
388 .\"O Too many open files (POSIX.1)
389 オープンされているファイルが多過ぎる (POSIX.1)
392 .\"O Too many links (POSIX.1)
396 .\"O Message too long (POSIX.1)
400 .\" POSIX says "Reserved"
401 .\"O Multihop attempted (POSIX.1)
402 マルチホップ (multihop) を試みた (POSIX.1)
405 .\"O Filename too long (POSIX.1)
407 .\" ENAVAIL is defined, but appears not to be used
410 .\"O Network is down (POSIX.1)
411 ネットワークが不通である (POSIX.1)
414 .\"O Connection aborted by network (POSIX.1)
415 接続がネットワーク側から中止された (POSIX.1)
418 .\"O Network unreachable (POSIX.1)
419 ネットワークが到達不能である (POSIX.1)
422 .\"O Too many open files in system (POSIX.1)
423 システム全体でオープンされているファイルが多過ぎる (POSIX.1)
424 .\" ENOANO is defined but appears to be unused.
427 .\"O No buffer space available (POSIX.1 (XSI STREAMS option))
428 使用可能なバッファ空間がない (POSIX.1 (XSI STREAMS option))
429 .\" ENOCSI is defined but appears to be unused.
432 .\"O No message is available on the STREAM head read queue (POSIX.1)
433 ストリームの読み出しキューの先頭に読み出し可能なメッセージがない
437 .\"O No such device (POSIX.1)
438 そのようなデバイスは無い (POSIX.1)
441 .\"O No such file or directory (POSIX.1)
442 そのようなファイルやディレクトリは無い (POSIX.1)
445 .\"O Exec format error (POSIX.1)
446 実行ファイル形式のエラー (POSIX.1)
449 .\"O Required key not available
453 .\"O No locks available (POSIX.1)
454 利用できるロックが無い (POSIX.1)
457 .\" POSIX says "Reserved"
458 .\"O Link has been severed (POSIX.1)
466 .\"O Not enough space (POSIX.1)
467 十分な空きメモリ領域が無い (POSIX.1)
470 .\"O No message of the desired type (POSIX.1)
471 要求された型のメッセージが存在しない (POSIX.1)
474 .\"O Machine is not on the network
478 .\"O Package not installed
482 .\"O Protocol not available (POSIX.1)
483 指定されたプロトコルが利用できない (POSIX.1)
486 .\"O No space left on device (POSIX.1)
487 デバイスに空き領域が無い (POSIX.1)
490 .\"O No STREAM resources (POSIX.1 (XSI STREAMS option))
491 指定されたストリーム・リソースが存在しない (POSIX.1 (XSI STREAMS option))
494 .\"O Not a STREAM (POSIX.1 (XSI STREAMS option))
495 ストリームではない (POSIX.1 (XSI STREAMS option))
498 .\"O Function not implemented (POSIX.1)
499 関数が実装されていない (POSIX.1)
502 .\"O Block device required
506 .\"O The socket is not connected (POSIX.1)
507 ソケットが接続されていない (POSIX.1)
510 .\"O Not a directory (POSIX.1)
514 .\"O Directory not empty (POSIX.1)
515 ディレクトリが空ではない (POSIX.1)
516 .\" ENOTNAM is defined but appears to be unused.
519 .\"O Not a socket (POSIX.1)
523 .\"O Operation not supported (POSIX.1)
524 操作がサポートされていない (POSIX.1)
527 .\"O Inappropriate I/O control operation (POSIX.1)
528 I/O 制御操作が適切でない (POSIX.1)
531 .\"O Name not unique on network
535 .\"O No such device or address (POSIX.1)
536 そのようなデバイスやアドレスはない (POSIX.1)
539 .\"O Operation not supported on socket (POSIX.1)
540 ソケットでサポートしていない操作である (POSIX.1)
545 .\"O have the same value on Linux, but
546 .\"O according to POSIX.1 these error values should be distinct.)
552 POSIX.1 に従えば両者のエラー値は区別されるべきである。)
555 .\"O Value too large to be stored in data type (POSIX.1)
556 指定されたデータ型に格納するには値が大き過ぎる (POSIX.1)
559 .\"O Operation not permitted (POSIX.1)
560 操作が許可されていない (POSIX.1)
563 .\"O Protocol family not supported
564 サポートされていないプロトコルファミリーである
567 .\"O Broken pipe (POSIX.1)
571 .\"O Protocol error (POSIX.1)
575 .\"O Protocol not supported (POSIX.1)
576 プロトコルがサポートされていない (POSIX.1)
579 .\"O Protocol wrong type for socket (POSIX.1)
580 ソケットに指定できないプロトコル・タイプである (POSIX.1)
583 .\"O Result too large (POSIX.1, C99)
584 結果が大き過ぎる (POSIX.1, C99)
587 .\"O Remote address changed
591 .\"O Object is remote
595 .\"O Remote I/O error
599 .\"O Interrupted system call should be restarted
600 システムコールが中断され再スタートが必要である
603 .\"O Read-only file system (POSIX.1)
604 読み出し専用のファイルシステムである (POSIX.1)
607 .\"O Cannot send after transport endpoint shutdown
608 通信相手がシャットダウンされて送信できない
611 .\"O Invalid seek (POSIX.1)
615 .\"O Socket type not supported
619 .\"O No such process (POSIX.1)
620 そのようなプロセスは無い (POSIX.1)
621 .\" ESRMNT is defined but appears not to be used
624 .\"O Stale file handle (POSIX.1)
625 ファイルハンドルが古い状態になっている (POSIX.1)
627 .\"O This error can occur for NFS and for other file systems
628 NFS や他のファイルシステムで起こりうる。
631 .\"O Streams pipe error
636 .\"O (POSIX.1 (XSI STREAMS option))
638 (POSIX.1 (XSI STREAMS option))
640 .\"O (POSIX.1 says "STREAM
648 .\"O Connection timed out (POSIX.1)
649 操作がタイムアウトした (POSIX.1)
650 .\" ETOOMANYREFS is defined, but appears not to be used.
653 .\"O Text file busy (POSIX.1)
654 テキストファイルが使用中である (POSIX.1)
657 .\"Omotoki: 意味が分からないので、そのまま原文を残してある。
658 .\"O Structure needs cleaning
659 Structure needs cleaning
662 .\"O Protocol driver not attached
663 プロトコルのドライバが付与 (attach) されていない
670 .\"O Operation would block (may be same value as
678 .\"O Improper link (POSIX.1)
686 .\"O A common mistake is to do
691 if (somecall() == \-1) {
692 printf("somecall() failed\en");
693 if (errno == ...) { ... }
700 .\"O no longer needs to have the value it had upon return from
702 .\"O (i.e., it may have been changed by the
703 .\"O .BR printf (3)).
713 .\"O should be preserved across a library call, it must be saved:
716 の値を保存したい場合は、以下のように保存しなければならない:
720 if (somecall() == \-1) {
722 printf("somecall() failed\en");
723 if (errsv == ...) { ... }
728 .\"O It was common in traditional C to declare
732 .\"O .IR "extern int errno" )
733 .\"O instead of including
735 .\"O .BR "Do not do this" .
736 .\"O It will not work with modern versions of the C library.
737 .\"O However, on (very) old UNIX systems, there may be no
739 .\"O and the declaration is needed.
745 .RI ( "extern int errno"
747 .BR "このようなことはしないこと" "。"
748 こうすると、最近のバージョンの C ライブラリでは正しく動作しないだろう。
749 しかし、(非常に) 古い UNIX システムでは、
751 がなく、宣言が必要なことがあるかもしれない。