Subversion Repositories Kolibri OS

Rev

Rev 4874 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4874 Rev 6099
1
/***
1
/***
2
**** CAUTION!!! KEEP DOC CONSISTENT---if you change text of a message
2
**** CAUTION!!! KEEP DOC CONSISTENT---if you change text of a message
3
****            here, change two places:
3
****            here, change two places:
4
****            1) the leading doc section (alphabetized by macro)
4
****            1) the leading doc section (alphabetized by macro)
5
****            2) the real text inside switch(errnum)
5
****            2) the real text inside switch(errnum)
6
***/
6
***/
7
 
7
 
8
/*
8
/*
9
FUNCTION
9
FUNCTION
10
	<>---convert error number to string
10
	<>---convert error number to string
11
 
11
 
12
INDEX
12
INDEX
13
	strerror
13
	strerror
14
 
14
 
15
ANSI_SYNOPSIS
15
ANSI_SYNOPSIS
16
	#include 
16
	#include 
17
	char *strerror(int <[errnum]>);
17
	char *strerror(int <[errnum]>);
18
	char *_strerror_r(struct _reent <[ptr]>, int <[errnum]>,
18
	char *_strerror_r(struct _reent <[ptr]>, int <[errnum]>,
19
			  int <[internal]>, int *<[error]>);
19
			  int <[internal]>, int *<[error]>);
20
 
20
 
21
TRAD_SYNOPSIS
21
TRAD_SYNOPSIS
22
	#include 
22
	#include 
23
	char *strerror(<[errnum]>)
23
	char *strerror(<[errnum]>)
24
	int <[errnum]>;
24
	int <[errnum]>;
25
 
25
 
26
DESCRIPTION
26
DESCRIPTION
27
<> converts the error number <[errnum]> into a
27
<> converts the error number <[errnum]> into a
28
string.  The value of <[errnum]> is usually a copy of <>.
28
string.  The value of <[errnum]> is usually a copy of <>.
29
If <> is not a known error number, the result points to an
29
If <> is not a known error number, the result points to an
30
empty string.
30
empty string.
31
 
31
 
32
This implementation of <> prints out the following strings
32
This implementation of <> prints out the following strings
33
for each of the values defined in `<>':
33
for each of the values defined in `<>':
34
 
34
 
35
o+
35
o+
36
o 0
36
o 0
37
Success
37
Success
38
 
38
 
39
o E2BIG
39
o E2BIG
40
Arg list too long
40
Arg list too long
41
 
41
 
42
o EACCES
42
o EACCES
43
Permission denied
43
Permission denied
44
 
44
 
45
o EADDRINUSE
45
o EADDRINUSE
46
Address already in use
46
Address already in use
-
 
47
 
-
 
48
o EADDRNOTAVAIL
-
 
49
Address not available
47
 
50
 
48
o EADV
51
o EADV
49
Advertise error
52
Advertise error
50
 
53
 
51
o EAFNOSUPPORT
54
o EAFNOSUPPORT
52
Address family not supported by protocol family
55
Address family not supported by protocol family
53
 
56
 
54
o EAGAIN
57
o EAGAIN
55
No more processes
58
No more processes
56
 
59
 
57
o EALREADY
60
o EALREADY
58
Socket already connected
61
Socket already connected
59
 
62
 
60
o EBADF
63
o EBADF
61
Bad file number
64
Bad file number
62
 
65
 
63
o EBADMSG
66
o EBADMSG
64
Bad message
67
Bad message
65
 
68
 
66
o EBUSY
69
o EBUSY
67
Device or resource busy
70
Device or resource busy
-
 
71
 
-
 
72
o ECANCELED
-
 
73
Operation canceled
68
 
74
 
69
o ECHILD
75
o ECHILD
70
No children
76
No children
71
 
77
 
72
o ECOMM
78
o ECOMM
73
Communication error
79
Communication error
74
 
80
 
75
o ECONNABORTED
81
o ECONNABORTED
76
Software caused connection abort
82
Software caused connection abort
77
 
83
 
78
o ECONNREFUSED
84
o ECONNREFUSED
79
Connection refused
85
Connection refused
-
 
86
 
-
 
87
o ECONNRESET
-
 
88
Connection reset by peer
80
 
89
 
81
o EDEADLK
90
o EDEADLK
82
Deadlock
91
Deadlock
83
 
92
 
84
o EDESTADDRREQ
93
o EDESTADDRREQ
85
Destination address required
94
Destination address required
86
 
95
 
87
o EEXIST
96
o EEXIST
88
File exists
97
File exists
89
 
98
 
90
o EDOM
99
o EDOM
91
Math argument
100
Mathematics argument out of domain of function
92
 
101
 
93
o EFAULT
102
o EFAULT
94
Bad address
103
Bad address
95
 
104
 
96
o EFBIG
105
o EFBIG
97
File too large
106
File too large
98
 
107
 
99
o EHOSTDOWN
108
o EHOSTDOWN
100
Host is down
109
Host is down
101
 
110
 
102
o EHOSTUNREACH
111
o EHOSTUNREACH
103
Host is unreachable
112
Host is unreachable
104
 
113
 
105
o EIDRM
114
o EIDRM
106
Identifier removed
115
Identifier removed
-
 
116
 
-
 
117
o EILSEQ
-
 
118
Illegal byte sequence
107
 
119
 
108
o EINPROGRESS
120
o EINPROGRESS
109
Connection already in progress
121
Connection already in progress
110
 
122
 
111
o EINTR
123
o EINTR
112
Interrupted system call
124
Interrupted system call
113
 
125
 
114
o EINVAL
126
o EINVAL
115
Invalid argument
127
Invalid argument
116
 
128
 
117
o EIO
129
o EIO
118
I/O error
130
I/O error
119
 
131
 
120
o EISCONN
132
o EISCONN
121
Socket is already connected
133
Socket is already connected
122
 
134
 
123
o EISDIR
135
o EISDIR
124
Is a directory
136
Is a directory
125
 
137
 
126
o ELIBACC
138
o ELIBACC
127
Cannot access a needed shared library
139
Cannot access a needed shared library
128
 
140
 
129
o ELIBBAD
141
o ELIBBAD
130
Accessing a corrupted shared library
142
Accessing a corrupted shared library
131
 
143
 
132
o ELIBEXEC
144
o ELIBEXEC
133
Cannot exec a shared library directly
145
Cannot exec a shared library directly
134
 
146
 
135
o ELIBMAX
147
o ELIBMAX
136
Attempting to link in more shared libraries than system limit
148
Attempting to link in more shared libraries than system limit
137
 
149
 
138
o ELIBSCN
150
o ELIBSCN
139
<<.lib>> section in a.out corrupted
151
<<.lib>> section in a.out corrupted
140
 
152
 
141
o EMFILE
153
o EMFILE
142
Too many open files
154
File descriptor value too large
143
 
155
 
144
o EMLINK
156
o EMLINK
145
Too many links
157
Too many links
146
 
158
 
147
o EMSGSIZE
159
o EMSGSIZE
148
Message too long
160
Message too long
149
 
161
 
150
o EMULTIHOP
162
o EMULTIHOP
151
Multihop attempted
163
Multihop attempted
152
 
164
 
153
o ENAMETOOLONG
165
o ENAMETOOLONG
154
File or path name too long
166
File or path name too long
155
 
167
 
156
o ENETDOWN
168
o ENETDOWN
157
Network interface not configured
169
Network interface is not configured
-
 
170
 
-
 
171
o ENETRESET
-
 
172
Connection aborted by network
158
 
173
 
159
o ENETUNREACH
174
o ENETUNREACH
160
Network is unreachable
175
Network is unreachable
161
 
176
 
162
o ENFILE
177
o ENFILE
163
Too many open files in system
178
Too many open files in system
-
 
179
 
-
 
180
o ENOBUFS
-
 
181
No buffer space available
-
 
182
 
-
 
183
o ENODATA
-
 
184
No data
164
 
185
 
165
o ENODEV
186
o ENODEV
166
No such device
187
No such device
167
 
188
 
168
o ENOENT
189
o ENOENT
169
No such file or directory
190
No such file or directory
170
 
191
 
171
o ENOEXEC
192
o ENOEXEC
172
Exec format error
193
Exec format error
173
 
194
 
174
o ENOLCK
195
o ENOLCK
175
No lock
196
No lock
176
 
197
 
177
o ENOLINK
198
o ENOLINK
178
Virtual circuit is gone
199
Virtual circuit is gone
179
 
200
 
180
o ENOMEM
201
o ENOMEM
181
Not enough space
202
Not enough space
182
 
203
 
183
o ENOMSG
204
o ENOMSG
184
No message of desired type
205
No message of desired type
185
 
206
 
186
o ENONET
207
o ENONET
187
Machine is not on the network
208
Machine is not on the network
188
 
209
 
189
o ENOPKG
210
o ENOPKG
190
No package
211
No package
191
 
212
 
192
o ENOPROTOOPT
213
o ENOPROTOOPT
193
Protocol not available
214
Protocol not available
194
 
215
 
195
o ENOSPC
216
o ENOSPC
196
No space left on device
217
No space left on device
197
 
218
 
198
o ENOSR
219
o ENOSR
199
No stream resources
220
No stream resources
200
 
221
 
201
o ENOSTR
222
o ENOSTR
202
Not a stream
223
Not a stream
203
 
224
 
204
o ENOSYS
225
o ENOSYS
205
Function not implemented
226
Function not implemented
206
 
227
 
207
o ENOTBLK
228
o ENOTBLK
208
Block device required
229
Block device required
209
 
230
 
210
o ENOTCONN
231
o ENOTCONN
211
Socket is not connected
232
Socket is not connected
212
 
233
 
213
o ENOTDIR
234
o ENOTDIR
214
Not a directory
235
Not a directory
215
 
236
 
216
o ENOTEMPTY
237
o ENOTEMPTY
217
Directory not empty
238
Directory not empty
-
 
239
 
-
 
240
o ENOTRECOVERABLE
-
 
241
State not recoverable
218
 
242
 
219
o ENOTSOCK
243
o ENOTSOCK
220
Socket operation on non-socket
244
Socket operation on non-socket
221
 
245
 
222
o ENOTSUP
246
o ENOTSUP
223
Not supported
247
Not supported
224
 
248
 
225
o ENOTTY
249
o ENOTTY
226
Not a character device
250
Not a character device
227
 
251
 
228
o ENXIO
252
o ENXIO
229
No such device or address
253
No such device or address
-
 
254
 
-
 
255
o EOPNOTSUPP
-
 
256
Operation not supported on socket
-
 
257
 
-
 
258
o EOVERFLOW
-
 
259
Value too large for defined data type
-
 
260
 
-
 
261
o EOWNERDEAD
-
 
262
Previous owner died
230
 
263
 
231
o EPERM
264
o EPERM
232
Not owner
265
Not owner
233
 
266
 
234
o EPIPE
267
o EPIPE
235
Broken pipe
268
Broken pipe
236
 
269
 
237
o EPROTO
270
o EPROTO
238
Protocol error
271
Protocol error
239
 
272
 
240
o EPROTOTYPE
273
o EPROTOTYPE
241
Protocol wrong type for socket
274
Protocol wrong type for socket
242
 
275
 
243
o EPROTONOSUPPORT
276
o EPROTONOSUPPORT
244
Unknown protocol
277
Unknown protocol
245
 
278
 
246
o ERANGE
279
o ERANGE
247
Result too large
280
Result too large
248
 
281
 
249
o EREMOTE
282
o EREMOTE
250
Resource is remote
283
Resource is remote
251
 
284
 
252
o EROFS
285
o EROFS
253
Read-only file system
286
Read-only file system
254
 
287
 
255
o ESHUTDOWN
288
o ESHUTDOWN
256
Can't send after socket shutdown
289
Can't send after socket shutdown
257
 
290
 
258
o ESOCKTNOSUPPORT
291
o ESOCKTNOSUPPORT
259
Socket type not supported
292
Socket type not supported
260
 
293
 
261
o ESPIPE
294
o ESPIPE
262
Illegal seek
295
Illegal seek
263
 
296
 
264
o ESRCH
297
o ESRCH
265
No such process
298
No such process
266
 
299
 
267
o ESRMNT
300
o ESRMNT
268
Srmount error
301
Srmount error
-
 
302
 
-
 
303
o ESTRPIPE
-
 
304
Strings pipe error
269
 
305
 
270
o ETIME
306
o ETIME
271
Stream ioctl timeout
307
Stream ioctl timeout
272
 
308
 
273
o ETIMEDOUT
309
o ETIMEDOUT
274
Connection timed out
310
Connection timed out
275
 
311
 
276
o ETXTBSY
312
o ETXTBSY
277
Text file busy
313
Text file busy
-
 
314
 
-
 
315
o EWOULDBLOCK
-
 
316
Operation would block (usually same as EAGAIN)
278
 
317
 
279
o EXDEV
318
o EXDEV
280
Cross-device link
319
Cross-device link
281
 
-
 
282
o ECANCELED
-
 
283
Operation canceled
-
 
284
 
-
 
285
o ENOTRECOVERABLE
-
 
286
State not recoverable
-
 
287
 
-
 
288
o EOWNERDEAD
-
 
289
Previous owner died
-
 
290
 
-
 
291
o ESTRPIPE
-
 
292
Strings pipe error
-
 
293
 
320
 
294
o-
321
o-
295
 
322
 
296
<<_strerror_r>> is a reentrant version of the above.
323
<<_strerror_r>> is a reentrant version of the above.
297
 
324
 
298
RETURNS
325
RETURNS
299
This function returns a pointer to a string.  Your application must
326
This function returns a pointer to a string.  Your application must
300
not modify that string.
327
not modify that string.
301
 
328
 
302
PORTABILITY
329
PORTABILITY
303
ANSI C requires <>, but does not specify the strings used
330
ANSI C requires <>, but does not specify the strings used
304
for each error number.
331
for each error number.
305
 
332
 
306
Although this implementation of <> is reentrant (depending
333
Although this implementation of <> is reentrant (depending
307
on <<_user_strerror>>), ANSI C declares that subsequent calls to
334
on <<_user_strerror>>), ANSI C declares that subsequent calls to
308
<> may overwrite the result string; therefore portable
335
<> may overwrite the result string; therefore portable
309
code cannot depend on the reentrancy of this subroutine.
336
code cannot depend on the reentrancy of this subroutine.
310
 
337
 
311
Although this implementation of <> guarantees a non-null
338
Although this implementation of <> guarantees a non-null
312
result with a NUL-terminator, some implementations return <>
339
result with a NUL-terminator, some implementations return <>
313
on failure.  Although POSIX allows <> to set <>
340
on failure.  Although POSIX allows <> to set <>
314
to EINVAL on failure, this implementation does not do so (unless
341
to EINVAL on failure, this implementation does not do so (unless
315
you provide <<_user_strerror>>).
342
you provide <<_user_strerror>>).
316
 
343
 
317
POSIX recommends that unknown <[errnum]> result in a message
344
POSIX recommends that unknown <[errnum]> result in a message
318
including that value, however it is not a requirement and this
345
including that value, however it is not a requirement and this
319
implementation does not provide that information (unless you
346
implementation does not provide that information (unless you
320
provide <<_user_strerror>>).
347
provide <<_user_strerror>>).
321
 
348
 
322
This implementation of <> provides for user-defined
349
This implementation of <> provides for user-defined
323
extensibility.  <> defines <[__ELASTERROR]>, which can be
350
extensibility.  <> defines <[__ELASTERROR]>, which can be
324
used as a base for user-defined error values.  If the user supplies a
351
used as a base for user-defined error values.  If the user supplies a
325
routine named <<_user_strerror>>, and <[errnum]> passed to
352
routine named <<_user_strerror>>, and <[errnum]> passed to
326
<> does not match any of the supported values,
353
<> does not match any of the supported values,
327
<<_user_strerror>> is called with three arguments.  The first is of
354
<<_user_strerror>> is called with three arguments.  The first is of
328
type <[int]>, and is the <[errnum]> value unknown to <>.
355
type <[int]>, and is the <[errnum]> value unknown to <>.
329
The second is of type <[int]>, and matches the <[internal]> argument
356
The second is of type <[int]>, and matches the <[internal]> argument
330
of <<_strerror_r>>; this should be zero if called from <>
357
of <<_strerror_r>>; this should be zero if called from <>
331
and non-zero if called from any other function; <<_user_strerror>> can
358
and non-zero if called from any other function; <<_user_strerror>> can
332
use this information to satisfy the POSIX rule that no other
359
use this information to satisfy the POSIX rule that no other
333
standardized function can overwrite a static buffer reused by
360
standardized function can overwrite a static buffer reused by
334
<>.  The third is of type <[int *]>, and matches the
361
<>.  The third is of type <[int *]>, and matches the
335
<[error]> argument of <<_strerror_r>>; if a non-zero value is stored
362
<[error]> argument of <<_strerror_r>>; if a non-zero value is stored
336
into that location (usually <[EINVAL]>), then <> will set
363
into that location (usually <[EINVAL]>), then <> will set
337
<> to that value, and the XPG variant of <> will
364
<> to that value, and the XPG variant of <> will
338
return that value instead of zero or <[ERANGE]>.  <<_user_strerror>>
365
return that value instead of zero or <[ERANGE]>.  <<_user_strerror>>
339
returns a <[char *]> value; returning <[NULL]> implies that the user
366
returns a <[char *]> value; returning <[NULL]> implies that the user
340
function did not choose to handle <[errnum]>.  The default
367
function did not choose to handle <[errnum]>.  The default
341
<<_user_strerror>> returns <[NULL]> for all input values.  Note that
368
<<_user_strerror>> returns <[NULL]> for all input values.  Note that
342
<<_user_sterror>> must be thread-safe, and only denote errors via the
369
<<_user_sterror>> must be thread-safe, and only denote errors via the
343
third argument rather than modifying <>, if <> and
370
third argument rather than modifying <>, if <> and
344
<> are are to comply with POSIX.
371
<> are are to comply with POSIX.
345
 
372
 
346
<> requires no supporting OS subroutines.
373
<> requires no supporting OS subroutines.
347
 
374
 
348
QUICKREF
375
QUICKREF
349
	strerror ansi pure
376
	strerror ansi pure
350
*/
377
*/
351
 
378
 
352
#include 
379
#include 
353
#include 
380
#include 
354
 
381
 
355
char *
382
char *
356
_DEFUN (_strerror_r, (ptr, errnum, internal, errptr),
383
_DEFUN (_strerror_r, (ptr, errnum, internal, errptr),
357
	struct _reent *ptr _AND
384
	struct _reent *ptr _AND
358
	int errnum _AND
385
	int errnum _AND
359
	int internal _AND
386
	int internal _AND
360
	int *errptr)
387
	int *errptr)
361
{
388
{
362
  char *error;
389
  char *error;
363
  extern char *_user_strerror _PARAMS ((int, int, int *));
390
  extern char *_user_strerror _PARAMS ((int, int, int *));
364
 
391
 
365
  switch (errnum)
392
  switch (errnum)
366
    {
393
    {
367
    case 0:
394
    case 0:
368
      error = "Success";
395
      error = "Success";
369
      break;
396
      break;
370
/* go32 defines EPERM as EACCES */
397
/* go32 defines EPERM as EACCES */
371
#if defined (EPERM) && (!defined (EACCES) || (EPERM != EACCES))
398
#if defined (EPERM) && (!defined (EACCES) || (EPERM != EACCES))
372
    case EPERM:
399
    case EPERM:
373
      error = "Not owner";
400
      error = "Not owner";
374
      break;
401
      break;
375
#endif
402
#endif
376
#ifdef ENOENT
403
#ifdef ENOENT
377
    case ENOENT:
404
    case ENOENT:
378
      error = "No such file or directory";
405
      error = "No such file or directory";
379
      break;
406
      break;
380
#endif
407
#endif
381
#ifdef ESRCH
408
#ifdef ESRCH
382
    case ESRCH:
409
    case ESRCH:
383
      error = "No such process";
410
      error = "No such process";
384
      break;
411
      break;
385
#endif
412
#endif
386
#ifdef EINTR
413
#ifdef EINTR
387
    case EINTR:
414
    case EINTR:
388
      error = "Interrupted system call";
415
      error = "Interrupted system call";
389
      break;
416
      break;
390
#endif
417
#endif
391
#ifdef EIO
418
#ifdef EIO
392
    case EIO:
419
    case EIO:
393
      error = "I/O error";
420
      error = "I/O error";
394
      break;
421
      break;
395
#endif
422
#endif
396
/* go32 defines ENXIO as ENODEV */
423
/* go32 defines ENXIO as ENODEV */
397
#if defined (ENXIO) && (!defined (ENODEV) || (ENXIO != ENODEV))
424
#if defined (ENXIO) && (!defined (ENODEV) || (ENXIO != ENODEV))
398
    case ENXIO:
425
    case ENXIO:
399
      error = "No such device or address";
426
      error = "No such device or address";
400
      break;
427
      break;
401
#endif
428
#endif
402
#ifdef E2BIG
429
#ifdef E2BIG
403
    case E2BIG:
430
    case E2BIG:
404
      error = "Arg list too long";
431
      error = "Arg list too long";
405
      break;
432
      break;
406
#endif
433
#endif
407
#ifdef ENOEXEC
434
#ifdef ENOEXEC
408
    case ENOEXEC:
435
    case ENOEXEC:
409
      error = "Exec format error";
436
      error = "Exec format error";
410
      break;
437
      break;
411
#endif
438
#endif
412
#ifdef EALREADY
439
#ifdef EALREADY
413
    case EALREADY:
440
    case EALREADY:
414
      error = "Socket already connected";
441
      error = "Socket already connected";
415
      break;
442
      break;
416
#endif
443
#endif
417
#ifdef EBADF
444
#ifdef EBADF
418
    case EBADF:
445
    case EBADF:
419
      error = "Bad file number";
446
      error = "Bad file number";
420
      break;
447
      break;
421
#endif
448
#endif
422
#ifdef ECHILD
449
#ifdef ECHILD
423
    case ECHILD:
450
    case ECHILD:
424
      error = "No children";
451
      error = "No children";
425
      break;
452
      break;
426
#endif
453
#endif
427
#ifdef EDESTADDRREQ
454
#ifdef EDESTADDRREQ
428
    case EDESTADDRREQ:
455
    case EDESTADDRREQ:
429
      error = "Destination address required";
456
      error = "Destination address required";
430
      break;
457
      break;
431
#endif
458
#endif
432
#ifdef EAGAIN
459
#ifdef EAGAIN
433
    case EAGAIN:
460
    case EAGAIN:
434
      error = "No more processes";
461
      error = "No more processes";
435
      break;
462
      break;
436
#endif
463
#endif
437
#ifdef ENOMEM
464
#ifdef ENOMEM
438
    case ENOMEM:
465
    case ENOMEM:
439
      error = "Not enough space";
466
      error = "Not enough space";
440
      break;
467
      break;
441
#endif
468
#endif
442
#ifdef EACCES
469
#ifdef EACCES
443
    case EACCES:
470
    case EACCES:
444
      error = "Permission denied";
471
      error = "Permission denied";
445
      break;
472
      break;
446
#endif
473
#endif
447
#ifdef EFAULT
474
#ifdef EFAULT
448
    case EFAULT:
475
    case EFAULT:
449
      error = "Bad address";
476
      error = "Bad address";
450
      break;
477
      break;
451
#endif
478
#endif
452
#ifdef ENOTBLK
479
#ifdef ENOTBLK
453
    case ENOTBLK:
480
    case ENOTBLK:
454
      error = "Block device required";
481
      error = "Block device required";
455
      break;
482
      break;
456
#endif
483
#endif
457
#ifdef EBUSY
484
#ifdef EBUSY
458
    case EBUSY:
485
    case EBUSY:
459
      error = "Device or resource busy";
486
      error = "Device or resource busy";
460
      break;
487
      break;
461
#endif
488
#endif
462
#ifdef EEXIST
489
#ifdef EEXIST
463
    case EEXIST:
490
    case EEXIST:
464
      error = "File exists";
491
      error = "File exists";
465
      break;
492
      break;
466
#endif
493
#endif
467
#ifdef EXDEV
494
#ifdef EXDEV
468
    case EXDEV:
495
    case EXDEV:
469
      error = "Cross-device link";
496
      error = "Cross-device link";
470
      break;
497
      break;
471
#endif
498
#endif
472
#ifdef ENODEV
499
#ifdef ENODEV
473
    case ENODEV:
500
    case ENODEV:
474
      error = "No such device";
501
      error = "No such device";
475
      break;
502
      break;
476
#endif
503
#endif
477
#ifdef ENOTDIR
504
#ifdef ENOTDIR
478
    case ENOTDIR:
505
    case ENOTDIR:
479
      error = "Not a directory";
506
      error = "Not a directory";
480
      break;
507
      break;
481
#endif
508
#endif
482
#ifdef EHOSTDOWN
509
#ifdef EHOSTDOWN
483
    case EHOSTDOWN:
510
    case EHOSTDOWN:
484
      error = "Host is down";
511
      error = "Host is down";
485
      break;
512
      break;
486
#endif
513
#endif
487
#ifdef EINPROGRESS
514
#ifdef EINPROGRESS
488
    case EINPROGRESS:
515
    case EINPROGRESS:
489
      error = "Connection already in progress";
516
      error = "Connection already in progress";
490
      break;
517
      break;
491
#endif
518
#endif
492
#ifdef EISDIR
519
#ifdef EISDIR
493
    case EISDIR:
520
    case EISDIR:
494
      error = "Is a directory";
521
      error = "Is a directory";
495
      break;
522
      break;
496
#endif
523
#endif
497
#ifdef EINVAL
524
#ifdef EINVAL
498
    case EINVAL:
525
    case EINVAL:
499
      error = "Invalid argument";
526
      error = "Invalid argument";
500
      break;
527
      break;
501
#endif
528
#endif
502
#ifdef ENETDOWN
529
#ifdef ENETDOWN
503
    case ENETDOWN:
530
    case ENETDOWN:
504
      error = "Network interface is not configured";
531
      error = "Network interface is not configured";
505
      break;
532
      break;
506
#endif
533
#endif
-
 
534
#ifdef ENETRESET
-
 
535
    case ENETRESET:
-
 
536
      error = "Connection aborted by network";
-
 
537
      break;
-
 
538
#endif
507
#ifdef ENFILE
539
#ifdef ENFILE
508
    case ENFILE:
540
    case ENFILE:
509
      error = "Too many open files in system";
541
      error = "Too many open files in system";
510
      break;
542
      break;
511
#endif
543
#endif
512
#ifdef EMFILE
544
#ifdef EMFILE
513
    case EMFILE:
545
    case EMFILE:
514
      error = "Too many open files";
546
      error = "File descriptor value too large";
515
      break;
547
      break;
516
#endif
548
#endif
517
#ifdef ENOTTY
549
#ifdef ENOTTY
518
    case ENOTTY:
550
    case ENOTTY:
519
      error = "Not a character device";
551
      error = "Not a character device";
520
      break;
552
      break;
521
#endif
553
#endif
522
#ifdef ETXTBSY
554
#ifdef ETXTBSY
523
    case ETXTBSY:
555
    case ETXTBSY:
524
      error = "Text file busy";
556
      error = "Text file busy";
525
      break;
557
      break;
526
#endif
558
#endif
527
#ifdef EFBIG
559
#ifdef EFBIG
528
    case EFBIG:
560
    case EFBIG:
529
      error = "File too large";
561
      error = "File too large";
530
      break;
562
      break;
531
#endif
563
#endif
532
#ifdef EHOSTUNREACH
564
#ifdef EHOSTUNREACH
533
    case EHOSTUNREACH:
565
    case EHOSTUNREACH:
534
      error = "Host is unreachable";
566
      error = "Host is unreachable";
535
      break;
567
      break;
536
#endif
568
#endif
537
#ifdef ENOSPC
569
#ifdef ENOSPC
538
    case ENOSPC:
570
    case ENOSPC:
539
      error = "No space left on device";
571
      error = "No space left on device";
540
      break;
572
      break;
541
#endif
573
#endif
542
#ifdef ENOTSUP
574
#ifdef ENOTSUP
543
    case ENOTSUP:
575
    case ENOTSUP:
544
      error = "Not supported";
576
      error = "Not supported";
545
      break;
577
      break;
546
#endif
578
#endif
547
#ifdef ESPIPE
579
#ifdef ESPIPE
548
    case ESPIPE:
580
    case ESPIPE:
549
      error = "Illegal seek";
581
      error = "Illegal seek";
550
      break;
582
      break;
551
#endif
583
#endif
552
#ifdef EROFS
584
#ifdef EROFS
553
    case EROFS:
585
    case EROFS:
554
      error = "Read-only file system";
586
      error = "Read-only file system";
555
      break;
587
      break;
556
#endif
588
#endif
557
#ifdef EMLINK
589
#ifdef EMLINK
558
    case EMLINK:
590
    case EMLINK:
559
      error = "Too many links";
591
      error = "Too many links";
560
      break;
592
      break;
561
#endif
593
#endif
562
#ifdef EPIPE
594
#ifdef EPIPE
563
    case EPIPE:
595
    case EPIPE:
564
      error = "Broken pipe";
596
      error = "Broken pipe";
565
      break;
597
      break;
566
#endif
598
#endif
567
#ifdef EDOM
599
#ifdef EDOM
568
    case EDOM:
600
    case EDOM:
569
      error = "Math argument";
601
      error = "Mathematics argument out of domain of function";
570
      break;
602
      break;
571
#endif
603
#endif
572
#ifdef ERANGE
604
#ifdef ERANGE
573
    case ERANGE:
605
    case ERANGE:
574
      error = "Result too large";
606
      error = "Result too large";
575
      break;
607
      break;
576
#endif
608
#endif
577
#ifdef ENOMSG
609
#ifdef ENOMSG
578
    case ENOMSG:
610
    case ENOMSG:
579
      error = "No message of desired type";
611
      error = "No message of desired type";
580
      break;
612
      break;
581
#endif
613
#endif
582
#ifdef EIDRM
614
#ifdef EIDRM
583
    case EIDRM:
615
    case EIDRM:
584
      error = "Identifier removed";
616
      error = "Identifier removed";
585
      break;
617
      break;
586
#endif
618
#endif
-
 
619
#ifdef EILSEQ
-
 
620
    case EILSEQ:
-
 
621
      error = "Illegal byte sequence";
-
 
622
      break;
-
 
623
#endif
587
#ifdef EDEADLK
624
#ifdef EDEADLK
588
    case EDEADLK:
625
    case EDEADLK:
589
      error = "Deadlock";
626
      error = "Deadlock";
590
      break;
627
      break;
591
#endif
628
#endif
592
#ifdef ENETUNREACH
629
#ifdef ENETUNREACH
593
    case  ENETUNREACH:
630
    case  ENETUNREACH:
594
      error = "Network is unreachable";
631
      error = "Network is unreachable";
595
      break;
632
      break;
596
#endif
633
#endif
597
#ifdef ENOLCK
634
#ifdef ENOLCK
598
    case ENOLCK:
635
    case ENOLCK:
599
      error = "No lock";
636
      error = "No lock";
600
      break;
637
      break;
601
#endif
638
#endif
602
#ifdef ENOSTR
639
#ifdef ENOSTR
603
    case ENOSTR:
640
    case ENOSTR:
604
      error = "Not a stream";
641
      error = "Not a stream";
605
      break;
642
      break;
606
#endif
643
#endif
607
#ifdef ETIME
644
#ifdef ETIME
608
    case ETIME:
645
    case ETIME:
609
      error = "Stream ioctl timeout";
646
      error = "Stream ioctl timeout";
610
      break;
647
      break;
611
#endif
648
#endif
612
#ifdef ENOSR
649
#ifdef ENOSR
613
    case ENOSR:
650
    case ENOSR:
614
      error = "No stream resources";
651
      error = "No stream resources";
615
      break;
652
      break;
616
#endif
653
#endif
617
#ifdef ENONET
654
#ifdef ENONET
618
    case ENONET:
655
    case ENONET:
619
      error = "Machine is not on the network";
656
      error = "Machine is not on the network";
620
      break;
657
      break;
621
#endif
658
#endif
622
#ifdef ENOPKG
659
#ifdef ENOPKG
623
    case ENOPKG:
660
    case ENOPKG:
624
      error = "No package";
661
      error = "No package";
625
      break;
662
      break;
626
#endif
663
#endif
627
#ifdef EREMOTE
664
#ifdef EREMOTE
628
    case EREMOTE:
665
    case EREMOTE:
629
      error = "Resource is remote";
666
      error = "Resource is remote";
630
      break;
667
      break;
631
#endif
668
#endif
632
#ifdef ENOLINK
669
#ifdef ENOLINK
633
    case ENOLINK:
670
    case ENOLINK:
634
      error = "Virtual circuit is gone";
671
      error = "Virtual circuit is gone";
635
      break;
672
      break;
636
#endif
673
#endif
637
#ifdef EADV
674
#ifdef EADV
638
    case EADV:
675
    case EADV:
639
      error = "Advertise error";
676
      error = "Advertise error";
640
      break;
677
      break;
641
#endif
678
#endif
642
#ifdef ESRMNT
679
#ifdef ESRMNT
643
    case ESRMNT:
680
    case ESRMNT:
644
      error = "Srmount error";
681
      error = "Srmount error";
645
      break;
682
      break;
646
#endif
683
#endif
647
#ifdef ECOMM
684
#ifdef ECOMM
648
    case ECOMM:
685
    case ECOMM:
649
      error = "Communication error";
686
      error = "Communication error";
650
      break;
687
      break;
651
#endif
688
#endif
652
#ifdef EPROTO
689
#ifdef EPROTO
653
    case EPROTO:
690
    case EPROTO:
654
      error = "Protocol error";
691
      error = "Protocol error";
655
      break;
692
      break;
656
#endif
693
#endif
657
#ifdef EPROTONOSUPPORT
694
#ifdef EPROTONOSUPPORT
658
    case EPROTONOSUPPORT:
695
    case EPROTONOSUPPORT:
659
      error = "Unknown protocol";
696
      error = "Unknown protocol";
660
      break;
697
      break;
661
#endif
698
#endif
662
#ifdef EMULTIHOP
699
#ifdef EMULTIHOP
663
    case EMULTIHOP:
700
    case EMULTIHOP:
664
      error = "Multihop attempted";
701
      error = "Multihop attempted";
665
      break;
702
      break;
666
#endif
703
#endif
667
#ifdef EBADMSG
704
#ifdef EBADMSG
668
    case EBADMSG:
705
    case EBADMSG:
669
      error = "Bad message";
706
      error = "Bad message";
670
      break;
707
      break;
671
#endif
708
#endif
672
#ifdef ELIBACC
709
#ifdef ELIBACC
673
    case ELIBACC:
710
    case ELIBACC:
674
      error = "Cannot access a needed shared library";
711
      error = "Cannot access a needed shared library";
675
      break;
712
      break;
676
#endif
713
#endif
677
#ifdef ELIBBAD
714
#ifdef ELIBBAD
678
    case ELIBBAD:
715
    case ELIBBAD:
679
      error = "Accessing a corrupted shared library";
716
      error = "Accessing a corrupted shared library";
680
      break;
717
      break;
681
#endif
718
#endif
682
#ifdef ELIBSCN
719
#ifdef ELIBSCN
683
    case ELIBSCN:
720
    case ELIBSCN:
684
      error = ".lib section in a.out corrupted";
721
      error = ".lib section in a.out corrupted";
685
      break;
722
      break;
686
#endif
723
#endif
687
#ifdef ELIBMAX
724
#ifdef ELIBMAX
688
    case ELIBMAX:
725
    case ELIBMAX:
689
      error = "Attempting to link in more shared libraries than system limit";
726
      error = "Attempting to link in more shared libraries than system limit";
690
      break;
727
      break;
691
#endif
728
#endif
692
#ifdef ELIBEXEC
729
#ifdef ELIBEXEC
693
    case ELIBEXEC:
730
    case ELIBEXEC:
694
      error = "Cannot exec a shared library directly";
731
      error = "Cannot exec a shared library directly";
695
      break;
732
      break;
696
#endif
733
#endif
697
#ifdef ENOSYS
734
#ifdef ENOSYS
698
    case ENOSYS:
735
    case ENOSYS:
699
      error = "Function not implemented";
736
      error = "Function not implemented";
700
      break;
737
      break;
701
#endif
738
#endif
702
#ifdef ENMFILE
739
#ifdef ENMFILE
703
    case ENMFILE:
740
    case ENMFILE:
704
      error = "No more files";
741
      error = "No more files";
705
      break;
742
      break;
706
#endif
743
#endif
707
#ifdef ENOTEMPTY
744
#ifdef ENOTEMPTY
708
    case ENOTEMPTY:
745
    case ENOTEMPTY:
709
      error = "Directory not empty";
746
      error = "Directory not empty";
710
      break;
747
      break;
711
#endif
748
#endif
712
#ifdef ENAMETOOLONG
749
#ifdef ENAMETOOLONG
713
    case ENAMETOOLONG:
750
    case ENAMETOOLONG:
714
      error = "File or path name too long";
751
      error = "File or path name too long";
715
      break;
752
      break;
716
#endif
753
#endif
717
#ifdef ELOOP
754
#ifdef ELOOP
718
    case ELOOP:
755
    case ELOOP:
719
      error = "Too many symbolic links";
756
      error = "Too many symbolic links";
720
      break;
757
      break;
721
#endif
758
#endif
722
#ifdef ENOBUFS
759
#ifdef ENOBUFS
723
    case ENOBUFS:
760
    case ENOBUFS:
724
      error = "No buffer space available";
761
      error = "No buffer space available";
725
      break;
762
      break;
726
#endif
763
#endif
-
 
764
#ifdef ENODATA
-
 
765
    case ENODATA:
-
 
766
      error = "No data";
-
 
767
      break;
-
 
768
#endif
727
#ifdef EAFNOSUPPORT
769
#ifdef EAFNOSUPPORT
728
    case EAFNOSUPPORT:
770
    case EAFNOSUPPORT:
729
      error = "Address family not supported by protocol family";
771
      error = "Address family not supported by protocol family";
730
      break;
772
      break;
731
#endif
773
#endif
732
#ifdef EPROTOTYPE
774
#ifdef EPROTOTYPE
733
    case EPROTOTYPE:
775
    case EPROTOTYPE:
734
      error = "Protocol wrong type for socket";
776
      error = "Protocol wrong type for socket";
735
      break;
777
      break;
736
#endif
778
#endif
737
#ifdef ENOTSOCK
779
#ifdef ENOTSOCK
738
    case ENOTSOCK:
780
    case ENOTSOCK:
739
      error = "Socket operation on non-socket";
781
      error = "Socket operation on non-socket";
740
      break;
782
      break;
741
#endif
783
#endif
742
#ifdef ENOPROTOOPT
784
#ifdef ENOPROTOOPT
743
    case ENOPROTOOPT:
785
    case ENOPROTOOPT:
744
      error = "Protocol not available";
786
      error = "Protocol not available";
745
      break;
787
      break;
746
#endif
788
#endif
747
#ifdef ESHUTDOWN
789
#ifdef ESHUTDOWN
748
    case ESHUTDOWN:
790
    case ESHUTDOWN:
749
      error = "Can't send after socket shutdown";
791
      error = "Can't send after socket shutdown";
750
      break;
792
      break;
751
#endif
793
#endif
752
#ifdef ECONNREFUSED
794
#ifdef ECONNREFUSED
753
    case ECONNREFUSED:
795
    case ECONNREFUSED:
754
      error = "Connection refused";
796
      error = "Connection refused";
755
      break;
797
      break;
756
#endif
798
#endif
-
 
799
#ifdef ECONNRESET
-
 
800
    case ECONNRESET:
-
 
801
      error = "Connection reset by peer";
-
 
802
      break;
-
 
803
#endif
757
#ifdef EADDRINUSE
804
#ifdef EADDRINUSE
758
    case EADDRINUSE:
805
    case EADDRINUSE:
759
      error = "Address already in use";
806
      error = "Address already in use";
760
      break;
807
      break;
761
#endif
808
#endif
-
 
809
#ifdef EADDRNOTAVAIL
-
 
810
    case EADDRNOTAVAIL:
-
 
811
      error = "Address not available";
-
 
812
      break;
-
 
813
#endif
762
#ifdef ECONNABORTED
814
#ifdef ECONNABORTED
763
    case ECONNABORTED:
815
    case ECONNABORTED:
764
      error = "Software caused connection abort";
816
      error = "Software caused connection abort";
765
      break;
817
      break;
766
#endif
818
#endif
767
#if (defined(EWOULDBLOCK) && (!defined (EAGAIN) || (EWOULDBLOCK != EAGAIN)))
819
#if (defined(EWOULDBLOCK) && (!defined (EAGAIN) || (EWOULDBLOCK != EAGAIN)))
768
    case EWOULDBLOCK:
820
    case EWOULDBLOCK:
769
        error = "Operation would block";
821
        error = "Operation would block";
770
        break;
822
        break;
771
#endif
823
#endif
772
#ifdef ENOTCONN
824
#ifdef ENOTCONN
773
    case ENOTCONN:
825
    case ENOTCONN:
774
        error = "Socket is not connected";
826
        error = "Socket is not connected";
775
        break;
827
        break;
776
#endif
828
#endif
777
#ifdef ESOCKTNOSUPPORT
829
#ifdef ESOCKTNOSUPPORT
778
    case ESOCKTNOSUPPORT:
830
    case ESOCKTNOSUPPORT:
779
        error = "Socket type not supported";
831
        error = "Socket type not supported";
780
        break;
832
        break;
781
#endif
833
#endif
782
#ifdef EISCONN
834
#ifdef EISCONN
783
    case EISCONN:
835
    case EISCONN:
784
        error = "Socket is already connected";
836
        error = "Socket is already connected";
785
        break;
837
        break;
786
#endif
838
#endif
787
#ifdef ECANCELED
839
#ifdef ECANCELED
788
    case ECANCELED:
840
    case ECANCELED:
789
        error = "Operation canceled";
841
        error = "Operation canceled";
790
        break;
842
        break;
791
#endif
843
#endif
792
#ifdef ENOTRECOVERABLE
844
#ifdef ENOTRECOVERABLE
793
    case ENOTRECOVERABLE:
845
    case ENOTRECOVERABLE:
794
        error = "State not recoverable";
846
        error = "State not recoverable";
795
        break;
847
        break;
796
#endif
848
#endif
797
#ifdef EOWNERDEAD
849
#ifdef EOWNERDEAD
798
    case EOWNERDEAD:
850
    case EOWNERDEAD:
799
        error = "Previous owner died";
851
        error = "Previous owner died";
800
        break;
852
        break;
801
#endif
853
#endif
802
#ifdef ESTRPIPE
854
#ifdef ESTRPIPE
803
    case ESTRPIPE:
855
    case ESTRPIPE:
804
	error = "Streams pipe error";
856
	error = "Streams pipe error";
805
	break;
857
	break;
806
#endif
858
#endif
807
#if defined(EOPNOTSUPP) && (!defined(ENOTSUP) || (ENOTSUP != EOPNOTSUPP))
859
#if defined(EOPNOTSUPP) && (!defined(ENOTSUP) || (ENOTSUP != EOPNOTSUPP))
808
    case EOPNOTSUPP:
860
    case EOPNOTSUPP:
809
        error = "Operation not supported on socket";
861
        error = "Operation not supported on socket";
810
        break;
862
        break;
811
#endif
863
#endif
-
 
864
#ifdef EOVERFLOW
-
 
865
    case EOVERFLOW:
-
 
866
      error = "Value too large for defined data type";
-
 
867
      break;
-
 
868
#endif
812
#ifdef EMSGSIZE
869
#ifdef EMSGSIZE
813
    case EMSGSIZE:
870
    case EMSGSIZE:
814
        error = "Message too long";
871
        error = "Message too long";
815
        break;
872
        break;
816
#endif
873
#endif
817
#ifdef ETIMEDOUT
874
#ifdef ETIMEDOUT
818
    case ETIMEDOUT:
875
    case ETIMEDOUT:
819
        error = "Connection timed out";
876
        error = "Connection timed out";
820
        break;
877
        break;
821
#endif
878
#endif
822
    default:
879
    default:
823
      if (!errptr)
880
      if (!errptr)
824
        errptr = &ptr->_errno;
881
        errptr = &ptr->_errno;
825
      if ((error = _user_strerror (errnum, internal, errptr)) == 0)
882
      if ((error = _user_strerror (errnum, internal, errptr)) == 0)
826
	error = "";
883
        error = "";
827
      break;
884
      break;
828
    }
885
    }
829
 
886
 
830
  return error;
887
  return error;
831
}
888
}
832
 
889
 
833
char *
890
char *
834
_DEFUN(strerror, (int),
891
_DEFUN(strerror, (int),
835
       int errnum)
892
       int errnum)
836
{
893
{
837
  return _strerror_r (_REENT, errnum, 0, NULL);
894
  return _strerror_r (_REENT, errnum, 0, NULL);
838
}
895
}