2 **** CAUTION!!! KEEP DOC CONSISTENT---if you change text of a message
3 **** here, change two places:
4 **** 1) the leading doc section (alphabetized by macro)
5 **** 2) the real text inside switch(errnum)
10 <<strerror>>, <<strerror_l>>---convert error number to string
20 char *strerror(int <[errnum]>);
21 char *strerror_l(int <[errnum]>, locale_t <[locale]>);
22 char *_strerror_r(struct _reent <[ptr]>, int <[errnum]>,
23 int <[internal]>, int *<[error]>);
26 <<strerror>> converts the error number <[errnum]> into a
27 string. The value of <[errnum]> is usually a copy of <<errno>>.
28 If <<errnum>> is not a known error number, the result points to an
31 <<strerror_l>> is like <<strerror>> but creates a string in a format
32 as expected in locale <[locale]>. If <[locale]> is LC_GLOBAL_LOCALE or
33 not a valid locale object, the behaviour is undefined.
35 This implementation of <<strerror>> prints out the following strings
36 for each of the values defined in `<<errno.h>>':
49 Address already in use
58 Address family not supported by protocol family
64 Socket already connected
73 Device or resource busy
85 Software caused connection abort
91 Connection reset by peer
97 Destination address required
103 Mathematics argument out of domain of function
121 Illegal byte sequence
124 Connection already in progress
127 Interrupted system call
136 Socket is already connected
142 Cannot access a needed shared library
145 Accessing a corrupted shared library
148 Cannot exec a shared library directly
151 Attempting to link in more shared libraries than system limit
154 <<.lib>> section in a.out corrupted
157 File descriptor value too large
169 File or path name too long
172 Network interface is not configured
175 Connection aborted by network
178 Network is unreachable
181 Too many open files in system
184 No buffer space available
193 No such file or directory
202 Virtual circuit is gone
208 No message of desired type
211 Machine is not on the network
217 Protocol not available
220 No space left on device
229 Function not implemented
232 Block device required
235 Socket is not connected
244 State not recoverable
247 Socket operation on non-socket
253 Not a character device
256 No such device or address
259 Operation not supported on socket
262 Value too large for defined data type
277 Protocol wrong type for socket
289 Read-only file system
292 Can't send after socket shutdown
295 Socket type not supported
319 Operation would block (usually same as EAGAIN)
326 <<_strerror_r>> is a reentrant version of the above.
329 This function returns a pointer to a string. Your application must
330 not modify that string.
333 ANSI C requires <<strerror>>, but does not specify the strings used
334 for each error number.
336 <<strerror_l>> is POSIX-1.2008.
338 Although this implementation of <<strerror>> is reentrant (depending
339 on <<_user_strerror>>), ANSI C declares that subsequent calls to
340 <<strerror>> may overwrite the result string; therefore portable
341 code cannot depend on the reentrancy of this subroutine.
343 Although this implementation of <<strerror>> guarantees a non-null
344 result with a NUL-terminator, some implementations return <<NULL>>
345 on failure. Although POSIX allows <<strerror>> to set <<errno>>
346 to EINVAL on failure, this implementation does not do so (unless
347 you provide <<_user_strerror>>).
349 POSIX recommends that unknown <[errnum]> result in a message
350 including that value, however it is not a requirement and this
351 implementation does not provide that information (unless you
352 provide <<_user_strerror>>).
354 This implementation of <<strerror>> provides for user-defined
355 extensibility. <<errno.h>> defines <[__ELASTERROR]>, which can be
356 used as a base for user-defined error values. If the user supplies a
357 routine named <<_user_strerror>>, and <[errnum]> passed to
358 <<strerror>> does not match any of the supported values,
359 <<_user_strerror>> is called with three arguments. The first is of
360 type <[int]>, and is the <[errnum]> value unknown to <<strerror>>.
361 The second is of type <[int]>, and matches the <[internal]> argument
362 of <<_strerror_r>>; this should be zero if called from <<strerror>>
363 and non-zero if called from any other function; <<_user_strerror>> can
364 use this information to satisfy the POSIX rule that no other
365 standardized function can overwrite a static buffer reused by
366 <<strerror>>. The third is of type <[int *]>, and matches the
367 <[error]> argument of <<_strerror_r>>; if a non-zero value is stored
368 into that location (usually <[EINVAL]>), then <<strerror>> will set
369 <<errno>> to that value, and the XPG variant of <<strerror_r>> will
370 return that value instead of zero or <[ERANGE]>. <<_user_strerror>>
371 returns a <[char *]> value; returning <[NULL]> implies that the user
372 function did not choose to handle <[errnum]>. The default
373 <<_user_strerror>> returns <[NULL]> for all input values. Note that
374 <<_user_sterror>> must be thread-safe, and only denote errors via the
375 third argument rather than modifying <<errno>>, if <<strerror>> and
376 <<strerror_r>> are are to comply with POSIX.
378 <<strerror>> requires no supporting OS subroutines.
388 _strerror_r (struct _reent
*ptr
,
394 extern char *_user_strerror (int, int, int *);
401 /* go32 defines EPERM as EACCES */
402 #if defined (EPERM) && (!defined (EACCES) || (EPERM != EACCES))
409 error
= "No such file or directory";
414 error
= "No such process";
419 error
= "Interrupted system call";
427 /* go32 defines ENXIO as ENODEV */
428 #if defined (ENXIO) && (!defined (ENODEV) || (ENXIO != ENODEV))
430 error
= "No such device or address";
435 error
= "Arg list too long";
440 error
= "Exec format error";
445 error
= "Socket already connected";
450 error
= "Bad file number";
455 error
= "No children";
460 error
= "Destination address required";
465 error
= "No more processes";
470 error
= "Not enough space";
475 error
= "Permission denied";
480 error
= "Bad address";
485 error
= "Block device required";
490 error
= "Device or resource busy";
495 error
= "File exists";
500 error
= "Cross-device link";
505 error
= "No such device";
510 error
= "Not a directory";
515 error
= "Host is down";
520 error
= "Connection already in progress";
525 error
= "Is a directory";
530 error
= "Invalid argument";
535 error
= "Network interface is not configured";
540 error
= "Connection aborted by network";
545 error
= "Too many open files in system";
550 error
= "File descriptor value too large";
555 error
= "Not a character device";
560 error
= "Text file busy";
565 error
= "File too large";
570 error
= "Host is unreachable";
575 error
= "No space left on device";
580 error
= "Not supported";
585 error
= "Illegal seek";
590 error
= "Read-only file system";
595 error
= "Too many links";
600 error
= "Broken pipe";
605 error
= "Mathematics argument out of domain of function";
610 error
= "Result too large";
615 error
= "No message of desired type";
620 error
= "Identifier removed";
625 error
= "Illegal byte sequence";
635 error
= "Network is unreachable";
645 error
= "Not a stream";
650 error
= "Stream ioctl timeout";
655 error
= "No stream resources";
660 error
= "Machine is not on the network";
665 error
= "No package";
670 error
= "Resource is remote";
675 error
= "Virtual circuit is gone";
680 error
= "Advertise error";
685 error
= "Srmount error";
690 error
= "Communication error";
695 error
= "Protocol error";
698 #ifdef EPROTONOSUPPORT
699 case EPROTONOSUPPORT
:
700 error
= "Unknown protocol";
705 error
= "Multihop attempted";
710 error
= "Bad message";
715 error
= "Cannot access a needed shared library";
720 error
= "Accessing a corrupted shared library";
725 error
= ".lib section in a.out corrupted";
730 error
= "Attempting to link in more shared libraries than system limit";
735 error
= "Cannot exec a shared library directly";
740 error
= "Function not implemented";
745 error
= "No more files";
750 error
= "Directory not empty";
755 error
= "File or path name too long";
760 error
= "Too many symbolic links";
765 error
= "No buffer space available";
775 error
= "Address family not supported by protocol family";
780 error
= "Protocol wrong type for socket";
785 error
= "Socket operation on non-socket";
790 error
= "Protocol not available";
795 error
= "Can't send after socket shutdown";
800 error
= "Connection refused";
805 error
= "Connection reset by peer";
810 error
= "Address already in use";
815 error
= "Address not available";
820 error
= "Software caused connection abort";
823 #if (defined(EWOULDBLOCK) && (!defined (EAGAIN) || (EWOULDBLOCK != EAGAIN)))
825 error
= "Operation would block";
830 error
= "Socket is not connected";
833 #ifdef ESOCKTNOSUPPORT
834 case ESOCKTNOSUPPORT
:
835 error
= "Socket type not supported";
840 error
= "Socket is already connected";
845 error
= "Operation canceled";
848 #ifdef ENOTRECOVERABLE
849 case ENOTRECOVERABLE
:
850 error
= "State not recoverable";
855 error
= "Previous owner died";
860 error
= "Streams pipe error";
863 #if defined(EOPNOTSUPP) && (!defined(ENOTSUP) || (ENOTSUP != EOPNOTSUPP))
865 error
= "Operation not supported on socket";
870 error
= "Value too large for defined data type";
875 error
= "Message too long";
880 error
= "Connection timed out";
885 errptr
= &_REENT_ERRNO(ptr
);
886 if ((error
= _user_strerror (errnum
, internal
, errptr
)) == 0)
895 strerror (int errnum
)
897 return _strerror_r (_REENT
, errnum
, 0, NULL
);
901 strerror_l (int errnum
, locale_t locale
)
903 /* We don't support per-locale error messages. */
904 return _strerror_r (_REENT
, errnum
, 0, NULL
);