Coverage Report

Created: 2025-07-11 06:59

/src/Python-3.8.3/Modules/errnomodule.c
Line
Count
Source (jump to first uncovered line)
1
2
/* Errno module */
3
4
#include "Python.h"
5
6
/* Windows socket errors (WSA*)  */
7
#ifdef MS_WINDOWS
8
#define WIN32_LEAN_AND_MEAN
9
#include <windows.h>
10
/* The following constants were added to errno.h in VS2010 but have
11
   preferred WSA equivalents. */
12
#undef EADDRINUSE
13
#undef EADDRNOTAVAIL
14
#undef EAFNOSUPPORT
15
#undef EALREADY
16
#undef ECONNABORTED
17
#undef ECONNREFUSED
18
#undef ECONNRESET
19
#undef EDESTADDRREQ
20
#undef EHOSTUNREACH
21
#undef EINPROGRESS
22
#undef EISCONN
23
#undef ELOOP
24
#undef EMSGSIZE
25
#undef ENETDOWN
26
#undef ENETRESET
27
#undef ENETUNREACH
28
#undef ENOBUFS
29
#undef ENOPROTOOPT
30
#undef ENOTCONN
31
#undef ENOTSOCK
32
#undef EOPNOTSUPP
33
#undef EPROTONOSUPPORT
34
#undef EPROTOTYPE
35
#undef ETIMEDOUT
36
#undef EWOULDBLOCK
37
#endif
38
39
/*
40
 * Pull in the system error definitions
41
 */
42
43
static PyMethodDef errno_methods[] = {
44
    {NULL,              NULL}
45
};
46
47
/* Helper function doing the dictionary inserting */
48
49
static void
50
_inscode(PyObject *d, PyObject *de, const char *name, int code)
51
0
{
52
0
    PyObject *u = PyUnicode_FromString(name);
53
0
    PyObject *v = PyLong_FromLong((long) code);
54
55
    /* Don't bother checking for errors; they'll be caught at the end
56
     * of the module initialization function by the caller of
57
     * initerrno().
58
     */
59
0
    if (u && v) {
60
        /* insert in modules dict */
61
0
        PyDict_SetItem(d, u, v);
62
        /* insert in errorcode dict */
63
0
        PyDict_SetItem(de, v, u);
64
0
    }
65
0
    Py_XDECREF(u);
66
0
    Py_XDECREF(v);
67
0
}
68
69
PyDoc_STRVAR(errno__doc__,
70
"This module makes available standard errno system symbols.\n\
71
\n\
72
The value of each symbol is the corresponding integer value,\n\
73
e.g., on most systems, errno.ENOENT equals the integer 2.\n\
74
\n\
75
The dictionary errno.errorcode maps numeric codes to symbol names,\n\
76
e.g., errno.errorcode[2] could be the string 'ENOENT'.\n\
77
\n\
78
Symbols that are not relevant to the underlying system are not defined.\n\
79
\n\
80
To map error codes to error messages, use the function os.strerror(),\n\
81
e.g. os.strerror(2) could return 'No such file or directory'.");
82
83
static struct PyModuleDef errnomodule = {
84
    PyModuleDef_HEAD_INIT,
85
    "errno",
86
    errno__doc__,
87
    -1,
88
    errno_methods,
89
    NULL,
90
    NULL,
91
    NULL,
92
    NULL
93
};
94
95
PyMODINIT_FUNC
96
PyInit_errno(void)
97
0
{
98
0
    PyObject *m, *d, *de;
99
0
    m = PyModule_Create(&errnomodule);
100
0
    if (m == NULL)
101
0
        return NULL;
102
0
    d = PyModule_GetDict(m);
103
0
    de = PyDict_New();
104
0
    if (!d || !de || PyDict_SetItemString(d, "errorcode", de) < 0)
105
0
        return NULL;
106
107
/* Macro so I don't have to edit each and every line below... */
108
0
#define inscode(d, ds, de, name, code, comment) _inscode(d, de, name, code)
109
110
    /*
111
     * The names and comments are borrowed from linux/include/errno.h,
112
     * which should be pretty all-inclusive.  However, the Solaris specific
113
     * names and comments are borrowed from sys/errno.h in Solaris.
114
     * MacOSX specific names and comments are borrowed from sys/errno.h in
115
     * MacOSX.
116
     */
117
118
0
#ifdef ENODEV
119
0
    inscode(d, ds, de, "ENODEV", ENODEV, "No such device");
120
0
#endif
121
0
#ifdef ENOCSI
122
0
    inscode(d, ds, de, "ENOCSI", ENOCSI, "No CSI structure available");
123
0
#endif
124
0
#ifdef EHOSTUNREACH
125
0
    inscode(d, ds, de, "EHOSTUNREACH", EHOSTUNREACH, "No route to host");
126
#else
127
#ifdef WSAEHOSTUNREACH
128
    inscode(d, ds, de, "EHOSTUNREACH", WSAEHOSTUNREACH, "No route to host");
129
#endif
130
#endif
131
0
#ifdef ENOMSG
132
0
    inscode(d, ds, de, "ENOMSG", ENOMSG, "No message of desired type");
133
0
#endif
134
0
#ifdef EUCLEAN
135
0
    inscode(d, ds, de, "EUCLEAN", EUCLEAN, "Structure needs cleaning");
136
0
#endif
137
0
#ifdef EL2NSYNC
138
0
    inscode(d, ds, de, "EL2NSYNC", EL2NSYNC, "Level 2 not synchronized");
139
0
#endif
140
0
#ifdef EL2HLT
141
0
    inscode(d, ds, de, "EL2HLT", EL2HLT, "Level 2 halted");
142
0
#endif
143
0
#ifdef ENODATA
144
0
    inscode(d, ds, de, "ENODATA", ENODATA, "No data available");
145
0
#endif
146
0
#ifdef ENOTBLK
147
0
    inscode(d, ds, de, "ENOTBLK", ENOTBLK, "Block device required");
148
0
#endif
149
0
#ifdef ENOSYS
150
0
    inscode(d, ds, de, "ENOSYS", ENOSYS, "Function not implemented");
151
0
#endif
152
0
#ifdef EPIPE
153
0
    inscode(d, ds, de, "EPIPE", EPIPE, "Broken pipe");
154
0
#endif
155
0
#ifdef EINVAL
156
0
    inscode(d, ds, de, "EINVAL", EINVAL, "Invalid argument");
157
#else
158
#ifdef WSAEINVAL
159
    inscode(d, ds, de, "EINVAL", WSAEINVAL, "Invalid argument");
160
#endif
161
#endif
162
0
#ifdef EOVERFLOW
163
0
    inscode(d, ds, de, "EOVERFLOW", EOVERFLOW, "Value too large for defined data type");
164
0
#endif
165
0
#ifdef EADV
166
0
    inscode(d, ds, de, "EADV", EADV, "Advertise error");
167
0
#endif
168
0
#ifdef EINTR
169
0
    inscode(d, ds, de, "EINTR", EINTR, "Interrupted system call");
170
#else
171
#ifdef WSAEINTR
172
    inscode(d, ds, de, "EINTR", WSAEINTR, "Interrupted system call");
173
#endif
174
#endif
175
0
#ifdef EUSERS
176
0
    inscode(d, ds, de, "EUSERS", EUSERS, "Too many users");
177
#else
178
#ifdef WSAEUSERS
179
    inscode(d, ds, de, "EUSERS", WSAEUSERS, "Too many users");
180
#endif
181
#endif
182
0
#ifdef ENOTEMPTY
183
0
    inscode(d, ds, de, "ENOTEMPTY", ENOTEMPTY, "Directory not empty");
184
#else
185
#ifdef WSAENOTEMPTY
186
    inscode(d, ds, de, "ENOTEMPTY", WSAENOTEMPTY, "Directory not empty");
187
#endif
188
#endif
189
0
#ifdef ENOBUFS
190
0
    inscode(d, ds, de, "ENOBUFS", ENOBUFS, "No buffer space available");
191
#else
192
#ifdef WSAENOBUFS
193
    inscode(d, ds, de, "ENOBUFS", WSAENOBUFS, "No buffer space available");
194
#endif
195
#endif
196
0
#ifdef EPROTO
197
0
    inscode(d, ds, de, "EPROTO", EPROTO, "Protocol error");
198
0
#endif
199
0
#ifdef EREMOTE
200
0
    inscode(d, ds, de, "EREMOTE", EREMOTE, "Object is remote");
201
#else
202
#ifdef WSAEREMOTE
203
    inscode(d, ds, de, "EREMOTE", WSAEREMOTE, "Object is remote");
204
#endif
205
#endif
206
0
#ifdef ENAVAIL
207
0
    inscode(d, ds, de, "ENAVAIL", ENAVAIL, "No XENIX semaphores available");
208
0
#endif
209
0
#ifdef ECHILD
210
0
    inscode(d, ds, de, "ECHILD", ECHILD, "No child processes");
211
0
#endif
212
0
#ifdef ELOOP
213
0
    inscode(d, ds, de, "ELOOP", ELOOP, "Too many symbolic links encountered");
214
#else
215
#ifdef WSAELOOP
216
    inscode(d, ds, de, "ELOOP", WSAELOOP, "Too many symbolic links encountered");
217
#endif
218
#endif
219
0
#ifdef EXDEV
220
0
    inscode(d, ds, de, "EXDEV", EXDEV, "Cross-device link");
221
0
#endif
222
0
#ifdef E2BIG
223
0
    inscode(d, ds, de, "E2BIG", E2BIG, "Arg list too long");
224
0
#endif
225
0
#ifdef ESRCH
226
0
    inscode(d, ds, de, "ESRCH", ESRCH, "No such process");
227
0
#endif
228
0
#ifdef EMSGSIZE
229
0
    inscode(d, ds, de, "EMSGSIZE", EMSGSIZE, "Message too long");
230
#else
231
#ifdef WSAEMSGSIZE
232
    inscode(d, ds, de, "EMSGSIZE", WSAEMSGSIZE, "Message too long");
233
#endif
234
#endif
235
0
#ifdef EAFNOSUPPORT
236
0
    inscode(d, ds, de, "EAFNOSUPPORT", EAFNOSUPPORT, "Address family not supported by protocol");
237
#else
238
#ifdef WSAEAFNOSUPPORT
239
    inscode(d, ds, de, "EAFNOSUPPORT", WSAEAFNOSUPPORT, "Address family not supported by protocol");
240
#endif
241
#endif
242
0
#ifdef EBADR
243
0
    inscode(d, ds, de, "EBADR", EBADR, "Invalid request descriptor");
244
0
#endif
245
0
#ifdef EHOSTDOWN
246
0
    inscode(d, ds, de, "EHOSTDOWN", EHOSTDOWN, "Host is down");
247
#else
248
#ifdef WSAEHOSTDOWN
249
    inscode(d, ds, de, "EHOSTDOWN", WSAEHOSTDOWN, "Host is down");
250
#endif
251
#endif
252
0
#ifdef EPFNOSUPPORT
253
0
    inscode(d, ds, de, "EPFNOSUPPORT", EPFNOSUPPORT, "Protocol family not supported");
254
#else
255
#ifdef WSAEPFNOSUPPORT
256
    inscode(d, ds, de, "EPFNOSUPPORT", WSAEPFNOSUPPORT, "Protocol family not supported");
257
#endif
258
#endif
259
0
#ifdef ENOPROTOOPT
260
0
    inscode(d, ds, de, "ENOPROTOOPT", ENOPROTOOPT, "Protocol not available");
261
#else
262
#ifdef WSAENOPROTOOPT
263
    inscode(d, ds, de, "ENOPROTOOPT", WSAENOPROTOOPT, "Protocol not available");
264
#endif
265
#endif
266
0
#ifdef EBUSY
267
0
    inscode(d, ds, de, "EBUSY", EBUSY, "Device or resource busy");
268
0
#endif
269
0
#ifdef EWOULDBLOCK
270
0
    inscode(d, ds, de, "EWOULDBLOCK", EWOULDBLOCK, "Operation would block");
271
#else
272
#ifdef WSAEWOULDBLOCK
273
    inscode(d, ds, de, "EWOULDBLOCK", WSAEWOULDBLOCK, "Operation would block");
274
#endif
275
#endif
276
0
#ifdef EBADFD
277
0
    inscode(d, ds, de, "EBADFD", EBADFD, "File descriptor in bad state");
278
0
#endif
279
0
#ifdef EDOTDOT
280
0
    inscode(d, ds, de, "EDOTDOT", EDOTDOT, "RFS specific error");
281
0
#endif
282
0
#ifdef EISCONN
283
0
    inscode(d, ds, de, "EISCONN", EISCONN, "Transport endpoint is already connected");
284
#else
285
#ifdef WSAEISCONN
286
    inscode(d, ds, de, "EISCONN", WSAEISCONN, "Transport endpoint is already connected");
287
#endif
288
#endif
289
0
#ifdef ENOANO
290
0
    inscode(d, ds, de, "ENOANO", ENOANO, "No anode");
291
0
#endif
292
0
#ifdef ESHUTDOWN
293
0
    inscode(d, ds, de, "ESHUTDOWN", ESHUTDOWN, "Cannot send after transport endpoint shutdown");
294
#else
295
#ifdef WSAESHUTDOWN
296
    inscode(d, ds, de, "ESHUTDOWN", WSAESHUTDOWN, "Cannot send after transport endpoint shutdown");
297
#endif
298
#endif
299
0
#ifdef ECHRNG
300
0
    inscode(d, ds, de, "ECHRNG", ECHRNG, "Channel number out of range");
301
0
#endif
302
0
#ifdef ELIBBAD
303
0
    inscode(d, ds, de, "ELIBBAD", ELIBBAD, "Accessing a corrupted shared library");
304
0
#endif
305
0
#ifdef ENONET
306
0
    inscode(d, ds, de, "ENONET", ENONET, "Machine is not on the network");
307
0
#endif
308
0
#ifdef EBADE
309
0
    inscode(d, ds, de, "EBADE", EBADE, "Invalid exchange");
310
0
#endif
311
0
#ifdef EBADF
312
0
    inscode(d, ds, de, "EBADF", EBADF, "Bad file number");
313
#else
314
#ifdef WSAEBADF
315
    inscode(d, ds, de, "EBADF", WSAEBADF, "Bad file number");
316
#endif
317
#endif
318
0
#ifdef EMULTIHOP
319
0
    inscode(d, ds, de, "EMULTIHOP", EMULTIHOP, "Multihop attempted");
320
0
#endif
321
0
#ifdef EIO
322
0
    inscode(d, ds, de, "EIO", EIO, "I/O error");
323
0
#endif
324
0
#ifdef EUNATCH
325
0
    inscode(d, ds, de, "EUNATCH", EUNATCH, "Protocol driver not attached");
326
0
#endif
327
0
#ifdef EPROTOTYPE
328
0
    inscode(d, ds, de, "EPROTOTYPE", EPROTOTYPE, "Protocol wrong type for socket");
329
#else
330
#ifdef WSAEPROTOTYPE
331
    inscode(d, ds, de, "EPROTOTYPE", WSAEPROTOTYPE, "Protocol wrong type for socket");
332
#endif
333
#endif
334
0
#ifdef ENOSPC
335
0
    inscode(d, ds, de, "ENOSPC", ENOSPC, "No space left on device");
336
0
#endif
337
0
#ifdef ENOEXEC
338
0
    inscode(d, ds, de, "ENOEXEC", ENOEXEC, "Exec format error");
339
0
#endif
340
0
#ifdef EALREADY
341
0
    inscode(d, ds, de, "EALREADY", EALREADY, "Operation already in progress");
342
#else
343
#ifdef WSAEALREADY
344
    inscode(d, ds, de, "EALREADY", WSAEALREADY, "Operation already in progress");
345
#endif
346
#endif
347
0
#ifdef ENETDOWN
348
0
    inscode(d, ds, de, "ENETDOWN", ENETDOWN, "Network is down");
349
#else
350
#ifdef WSAENETDOWN
351
    inscode(d, ds, de, "ENETDOWN", WSAENETDOWN, "Network is down");
352
#endif
353
#endif
354
0
#ifdef ENOTNAM
355
0
    inscode(d, ds, de, "ENOTNAM", ENOTNAM, "Not a XENIX named type file");
356
0
#endif
357
0
#ifdef EACCES
358
0
    inscode(d, ds, de, "EACCES", EACCES, "Permission denied");
359
#else
360
#ifdef WSAEACCES
361
    inscode(d, ds, de, "EACCES", WSAEACCES, "Permission denied");
362
#endif
363
#endif
364
0
#ifdef ELNRNG
365
0
    inscode(d, ds, de, "ELNRNG", ELNRNG, "Link number out of range");
366
0
#endif
367
0
#ifdef EILSEQ
368
0
    inscode(d, ds, de, "EILSEQ", EILSEQ, "Illegal byte sequence");
369
0
#endif
370
0
#ifdef ENOTDIR
371
0
    inscode(d, ds, de, "ENOTDIR", ENOTDIR, "Not a directory");
372
0
#endif
373
0
#ifdef ENOTUNIQ
374
0
    inscode(d, ds, de, "ENOTUNIQ", ENOTUNIQ, "Name not unique on network");
375
0
#endif
376
0
#ifdef EPERM
377
0
    inscode(d, ds, de, "EPERM", EPERM, "Operation not permitted");
378
0
#endif
379
0
#ifdef EDOM
380
0
    inscode(d, ds, de, "EDOM", EDOM, "Math argument out of domain of func");
381
0
#endif
382
0
#ifdef EXFULL
383
0
    inscode(d, ds, de, "EXFULL", EXFULL, "Exchange full");
384
0
#endif
385
0
#ifdef ECONNREFUSED
386
0
    inscode(d, ds, de, "ECONNREFUSED", ECONNREFUSED, "Connection refused");
387
#else
388
#ifdef WSAECONNREFUSED
389
    inscode(d, ds, de, "ECONNREFUSED", WSAECONNREFUSED, "Connection refused");
390
#endif
391
#endif
392
0
#ifdef EISDIR
393
0
    inscode(d, ds, de, "EISDIR", EISDIR, "Is a directory");
394
0
#endif
395
0
#ifdef EPROTONOSUPPORT
396
0
    inscode(d, ds, de, "EPROTONOSUPPORT", EPROTONOSUPPORT, "Protocol not supported");
397
#else
398
#ifdef WSAEPROTONOSUPPORT
399
    inscode(d, ds, de, "EPROTONOSUPPORT", WSAEPROTONOSUPPORT, "Protocol not supported");
400
#endif
401
#endif
402
0
#ifdef EROFS
403
0
    inscode(d, ds, de, "EROFS", EROFS, "Read-only file system");
404
0
#endif
405
0
#ifdef EADDRNOTAVAIL
406
0
    inscode(d, ds, de, "EADDRNOTAVAIL", EADDRNOTAVAIL, "Cannot assign requested address");
407
#else
408
#ifdef WSAEADDRNOTAVAIL
409
    inscode(d, ds, de, "EADDRNOTAVAIL", WSAEADDRNOTAVAIL, "Cannot assign requested address");
410
#endif
411
#endif
412
0
#ifdef EIDRM
413
0
    inscode(d, ds, de, "EIDRM", EIDRM, "Identifier removed");
414
0
#endif
415
0
#ifdef ECOMM
416
0
    inscode(d, ds, de, "ECOMM", ECOMM, "Communication error on send");
417
0
#endif
418
0
#ifdef ESRMNT
419
0
    inscode(d, ds, de, "ESRMNT", ESRMNT, "Srmount error");
420
0
#endif
421
0
#ifdef EREMOTEIO
422
0
    inscode(d, ds, de, "EREMOTEIO", EREMOTEIO, "Remote I/O error");
423
0
#endif
424
0
#ifdef EL3RST
425
0
    inscode(d, ds, de, "EL3RST", EL3RST, "Level 3 reset");
426
0
#endif
427
0
#ifdef EBADMSG
428
0
    inscode(d, ds, de, "EBADMSG", EBADMSG, "Not a data message");
429
0
#endif
430
0
#ifdef ENFILE
431
0
    inscode(d, ds, de, "ENFILE", ENFILE, "File table overflow");
432
0
#endif
433
0
#ifdef ELIBMAX
434
0
    inscode(d, ds, de, "ELIBMAX", ELIBMAX, "Attempting to link in too many shared libraries");
435
0
#endif
436
0
#ifdef ESPIPE
437
0
    inscode(d, ds, de, "ESPIPE", ESPIPE, "Illegal seek");
438
0
#endif
439
0
#ifdef ENOLINK
440
0
    inscode(d, ds, de, "ENOLINK", ENOLINK, "Link has been severed");
441
0
#endif
442
0
#ifdef ENETRESET
443
0
    inscode(d, ds, de, "ENETRESET", ENETRESET, "Network dropped connection because of reset");
444
#else
445
#ifdef WSAENETRESET
446
    inscode(d, ds, de, "ENETRESET", WSAENETRESET, "Network dropped connection because of reset");
447
#endif
448
#endif
449
0
#ifdef ETIMEDOUT
450
0
    inscode(d, ds, de, "ETIMEDOUT", ETIMEDOUT, "Connection timed out");
451
#else
452
#ifdef WSAETIMEDOUT
453
    inscode(d, ds, de, "ETIMEDOUT", WSAETIMEDOUT, "Connection timed out");
454
#endif
455
#endif
456
0
#ifdef ENOENT
457
0
    inscode(d, ds, de, "ENOENT", ENOENT, "No such file or directory");
458
0
#endif
459
0
#ifdef EEXIST
460
0
    inscode(d, ds, de, "EEXIST", EEXIST, "File exists");
461
0
#endif
462
0
#ifdef EDQUOT
463
0
    inscode(d, ds, de, "EDQUOT", EDQUOT, "Quota exceeded");
464
#else
465
#ifdef WSAEDQUOT
466
    inscode(d, ds, de, "EDQUOT", WSAEDQUOT, "Quota exceeded");
467
#endif
468
#endif
469
0
#ifdef ENOSTR
470
0
    inscode(d, ds, de, "ENOSTR", ENOSTR, "Device not a stream");
471
0
#endif
472
0
#ifdef EBADSLT
473
0
    inscode(d, ds, de, "EBADSLT", EBADSLT, "Invalid slot");
474
0
#endif
475
0
#ifdef EBADRQC
476
0
    inscode(d, ds, de, "EBADRQC", EBADRQC, "Invalid request code");
477
0
#endif
478
0
#ifdef ELIBACC
479
0
    inscode(d, ds, de, "ELIBACC", ELIBACC, "Can not access a needed shared library");
480
0
#endif
481
0
#ifdef EFAULT
482
0
    inscode(d, ds, de, "EFAULT", EFAULT, "Bad address");
483
#else
484
#ifdef WSAEFAULT
485
    inscode(d, ds, de, "EFAULT", WSAEFAULT, "Bad address");
486
#endif
487
#endif
488
0
#ifdef EFBIG
489
0
    inscode(d, ds, de, "EFBIG", EFBIG, "File too large");
490
0
#endif
491
0
#ifdef EDEADLK
492
0
    inscode(d, ds, de, "EDEADLK", EDEADLK, "Resource deadlock would occur");
493
0
#endif
494
0
#ifdef ENOTCONN
495
0
    inscode(d, ds, de, "ENOTCONN", ENOTCONN, "Transport endpoint is not connected");
496
#else
497
#ifdef WSAENOTCONN
498
    inscode(d, ds, de, "ENOTCONN", WSAENOTCONN, "Transport endpoint is not connected");
499
#endif
500
#endif
501
0
#ifdef EDESTADDRREQ
502
0
    inscode(d, ds, de, "EDESTADDRREQ", EDESTADDRREQ, "Destination address required");
503
#else
504
#ifdef WSAEDESTADDRREQ
505
    inscode(d, ds, de, "EDESTADDRREQ", WSAEDESTADDRREQ, "Destination address required");
506
#endif
507
#endif
508
0
#ifdef ELIBSCN
509
0
    inscode(d, ds, de, "ELIBSCN", ELIBSCN, ".lib section in a.out corrupted");
510
0
#endif
511
0
#ifdef ENOLCK
512
0
    inscode(d, ds, de, "ENOLCK", ENOLCK, "No record locks available");
513
0
#endif
514
0
#ifdef EISNAM
515
0
    inscode(d, ds, de, "EISNAM", EISNAM, "Is a named type file");
516
0
#endif
517
0
#ifdef ECONNABORTED
518
0
    inscode(d, ds, de, "ECONNABORTED", ECONNABORTED, "Software caused connection abort");
519
#else
520
#ifdef WSAECONNABORTED
521
    inscode(d, ds, de, "ECONNABORTED", WSAECONNABORTED, "Software caused connection abort");
522
#endif
523
#endif
524
0
#ifdef ENETUNREACH
525
0
    inscode(d, ds, de, "ENETUNREACH", ENETUNREACH, "Network is unreachable");
526
#else
527
#ifdef WSAENETUNREACH
528
    inscode(d, ds, de, "ENETUNREACH", WSAENETUNREACH, "Network is unreachable");
529
#endif
530
#endif
531
0
#ifdef ESTALE
532
0
    inscode(d, ds, de, "ESTALE", ESTALE, "Stale NFS file handle");
533
#else
534
#ifdef WSAESTALE
535
    inscode(d, ds, de, "ESTALE", WSAESTALE, "Stale NFS file handle");
536
#endif
537
#endif
538
0
#ifdef ENOSR
539
0
    inscode(d, ds, de, "ENOSR", ENOSR, "Out of streams resources");
540
0
#endif
541
0
#ifdef ENOMEM
542
0
    inscode(d, ds, de, "ENOMEM", ENOMEM, "Out of memory");
543
0
#endif
544
0
#ifdef ENOTSOCK
545
0
    inscode(d, ds, de, "ENOTSOCK", ENOTSOCK, "Socket operation on non-socket");
546
#else
547
#ifdef WSAENOTSOCK
548
    inscode(d, ds, de, "ENOTSOCK", WSAENOTSOCK, "Socket operation on non-socket");
549
#endif
550
#endif
551
0
#ifdef ESTRPIPE
552
0
    inscode(d, ds, de, "ESTRPIPE", ESTRPIPE, "Streams pipe error");
553
0
#endif
554
0
#ifdef EMLINK
555
0
    inscode(d, ds, de, "EMLINK", EMLINK, "Too many links");
556
0
#endif
557
0
#ifdef ERANGE
558
0
    inscode(d, ds, de, "ERANGE", ERANGE, "Math result not representable");
559
0
#endif
560
0
#ifdef ELIBEXEC
561
0
    inscode(d, ds, de, "ELIBEXEC", ELIBEXEC, "Cannot exec a shared library directly");
562
0
#endif
563
0
#ifdef EL3HLT
564
0
    inscode(d, ds, de, "EL3HLT", EL3HLT, "Level 3 halted");
565
0
#endif
566
0
#ifdef ECONNRESET
567
0
    inscode(d, ds, de, "ECONNRESET", ECONNRESET, "Connection reset by peer");
568
#else
569
#ifdef WSAECONNRESET
570
    inscode(d, ds, de, "ECONNRESET", WSAECONNRESET, "Connection reset by peer");
571
#endif
572
#endif
573
0
#ifdef EADDRINUSE
574
0
    inscode(d, ds, de, "EADDRINUSE", EADDRINUSE, "Address already in use");
575
#else
576
#ifdef WSAEADDRINUSE
577
    inscode(d, ds, de, "EADDRINUSE", WSAEADDRINUSE, "Address already in use");
578
#endif
579
#endif
580
0
#ifdef EOPNOTSUPP
581
0
    inscode(d, ds, de, "EOPNOTSUPP", EOPNOTSUPP, "Operation not supported on transport endpoint");
582
#else
583
#ifdef WSAEOPNOTSUPP
584
    inscode(d, ds, de, "EOPNOTSUPP", WSAEOPNOTSUPP, "Operation not supported on transport endpoint");
585
#endif
586
#endif
587
0
#ifdef EREMCHG
588
0
    inscode(d, ds, de, "EREMCHG", EREMCHG, "Remote address changed");
589
0
#endif
590
0
#ifdef EAGAIN
591
0
    inscode(d, ds, de, "EAGAIN", EAGAIN, "Try again");
592
0
#endif
593
0
#ifdef ENAMETOOLONG
594
0
    inscode(d, ds, de, "ENAMETOOLONG", ENAMETOOLONG, "File name too long");
595
#else
596
#ifdef WSAENAMETOOLONG
597
    inscode(d, ds, de, "ENAMETOOLONG", WSAENAMETOOLONG, "File name too long");
598
#endif
599
#endif
600
0
#ifdef ENOTTY
601
0
    inscode(d, ds, de, "ENOTTY", ENOTTY, "Not a typewriter");
602
0
#endif
603
0
#ifdef ERESTART
604
0
    inscode(d, ds, de, "ERESTART", ERESTART, "Interrupted system call should be restarted");
605
0
#endif
606
0
#ifdef ESOCKTNOSUPPORT
607
0
    inscode(d, ds, de, "ESOCKTNOSUPPORT", ESOCKTNOSUPPORT, "Socket type not supported");
608
#else
609
#ifdef WSAESOCKTNOSUPPORT
610
    inscode(d, ds, de, "ESOCKTNOSUPPORT", WSAESOCKTNOSUPPORT, "Socket type not supported");
611
#endif
612
#endif
613
0
#ifdef ETIME
614
0
    inscode(d, ds, de, "ETIME", ETIME, "Timer expired");
615
0
#endif
616
0
#ifdef EBFONT
617
0
    inscode(d, ds, de, "EBFONT", EBFONT, "Bad font file format");
618
0
#endif
619
0
#ifdef EDEADLOCK
620
0
    inscode(d, ds, de, "EDEADLOCK", EDEADLOCK, "Error EDEADLOCK");
621
0
#endif
622
0
#ifdef ETOOMANYREFS
623
0
    inscode(d, ds, de, "ETOOMANYREFS", ETOOMANYREFS, "Too many references: cannot splice");
624
#else
625
#ifdef WSAETOOMANYREFS
626
    inscode(d, ds, de, "ETOOMANYREFS", WSAETOOMANYREFS, "Too many references: cannot splice");
627
#endif
628
#endif
629
0
#ifdef EMFILE
630
0
    inscode(d, ds, de, "EMFILE", EMFILE, "Too many open files");
631
#else
632
#ifdef WSAEMFILE
633
    inscode(d, ds, de, "EMFILE", WSAEMFILE, "Too many open files");
634
#endif
635
#endif
636
0
#ifdef ETXTBSY
637
0
    inscode(d, ds, de, "ETXTBSY", ETXTBSY, "Text file busy");
638
0
#endif
639
0
#ifdef EINPROGRESS
640
0
    inscode(d, ds, de, "EINPROGRESS", EINPROGRESS, "Operation now in progress");
641
#else
642
#ifdef WSAEINPROGRESS
643
    inscode(d, ds, de, "EINPROGRESS", WSAEINPROGRESS, "Operation now in progress");
644
#endif
645
#endif
646
0
#ifdef ENXIO
647
0
    inscode(d, ds, de, "ENXIO", ENXIO, "No such device or address");
648
0
#endif
649
0
#ifdef ENOPKG
650
0
    inscode(d, ds, de, "ENOPKG", ENOPKG, "Package not installed");
651
0
#endif
652
#ifdef WSASY
653
    inscode(d, ds, de, "WSASY", WSASY, "Error WSASY");
654
#endif
655
#ifdef WSAEHOSTDOWN
656
    inscode(d, ds, de, "WSAEHOSTDOWN", WSAEHOSTDOWN, "Host is down");
657
#endif
658
#ifdef WSAENETDOWN
659
    inscode(d, ds, de, "WSAENETDOWN", WSAENETDOWN, "Network is down");
660
#endif
661
#ifdef WSAENOTSOCK
662
    inscode(d, ds, de, "WSAENOTSOCK", WSAENOTSOCK, "Socket operation on non-socket");
663
#endif
664
#ifdef WSAEHOSTUNREACH
665
    inscode(d, ds, de, "WSAEHOSTUNREACH", WSAEHOSTUNREACH, "No route to host");
666
#endif
667
#ifdef WSAELOOP
668
    inscode(d, ds, de, "WSAELOOP", WSAELOOP, "Too many symbolic links encountered");
669
#endif
670
#ifdef WSAEMFILE
671
    inscode(d, ds, de, "WSAEMFILE", WSAEMFILE, "Too many open files");
672
#endif
673
#ifdef WSAESTALE
674
    inscode(d, ds, de, "WSAESTALE", WSAESTALE, "Stale NFS file handle");
675
#endif
676
#ifdef WSAVERNOTSUPPORTED
677
    inscode(d, ds, de, "WSAVERNOTSUPPORTED", WSAVERNOTSUPPORTED, "Error WSAVERNOTSUPPORTED");
678
#endif
679
#ifdef WSAENETUNREACH
680
    inscode(d, ds, de, "WSAENETUNREACH", WSAENETUNREACH, "Network is unreachable");
681
#endif
682
#ifdef WSAEPROCLIM
683
    inscode(d, ds, de, "WSAEPROCLIM", WSAEPROCLIM, "Error WSAEPROCLIM");
684
#endif
685
#ifdef WSAEFAULT
686
    inscode(d, ds, de, "WSAEFAULT", WSAEFAULT, "Bad address");
687
#endif
688
#ifdef WSANOTINITIALISED
689
    inscode(d, ds, de, "WSANOTINITIALISED", WSANOTINITIALISED, "Error WSANOTINITIALISED");
690
#endif
691
#ifdef WSAEUSERS
692
    inscode(d, ds, de, "WSAEUSERS", WSAEUSERS, "Too many users");
693
#endif
694
#ifdef WSAMAKEASYNCREPL
695
    inscode(d, ds, de, "WSAMAKEASYNCREPL", WSAMAKEASYNCREPL, "Error WSAMAKEASYNCREPL");
696
#endif
697
#ifdef WSAENOPROTOOPT
698
    inscode(d, ds, de, "WSAENOPROTOOPT", WSAENOPROTOOPT, "Protocol not available");
699
#endif
700
#ifdef WSAECONNABORTED
701
    inscode(d, ds, de, "WSAECONNABORTED", WSAECONNABORTED, "Software caused connection abort");
702
#endif
703
#ifdef WSAENAMETOOLONG
704
    inscode(d, ds, de, "WSAENAMETOOLONG", WSAENAMETOOLONG, "File name too long");
705
#endif
706
#ifdef WSAENOTEMPTY
707
    inscode(d, ds, de, "WSAENOTEMPTY", WSAENOTEMPTY, "Directory not empty");
708
#endif
709
#ifdef WSAESHUTDOWN
710
    inscode(d, ds, de, "WSAESHUTDOWN", WSAESHUTDOWN, "Cannot send after transport endpoint shutdown");
711
#endif
712
#ifdef WSAEAFNOSUPPORT
713
    inscode(d, ds, de, "WSAEAFNOSUPPORT", WSAEAFNOSUPPORT, "Address family not supported by protocol");
714
#endif
715
#ifdef WSAETOOMANYREFS
716
    inscode(d, ds, de, "WSAETOOMANYREFS", WSAETOOMANYREFS, "Too many references: cannot splice");
717
#endif
718
#ifdef WSAEACCES
719
    inscode(d, ds, de, "WSAEACCES", WSAEACCES, "Permission denied");
720
#endif
721
#ifdef WSATR
722
    inscode(d, ds, de, "WSATR", WSATR, "Error WSATR");
723
#endif
724
#ifdef WSABASEERR
725
    inscode(d, ds, de, "WSABASEERR", WSABASEERR, "Error WSABASEERR");
726
#endif
727
#ifdef WSADESCRIPTIO
728
    inscode(d, ds, de, "WSADESCRIPTIO", WSADESCRIPTIO, "Error WSADESCRIPTIO");
729
#endif
730
#ifdef WSAEMSGSIZE
731
    inscode(d, ds, de, "WSAEMSGSIZE", WSAEMSGSIZE, "Message too long");
732
#endif
733
#ifdef WSAEBADF
734
    inscode(d, ds, de, "WSAEBADF", WSAEBADF, "Bad file number");
735
#endif
736
#ifdef WSAECONNRESET
737
    inscode(d, ds, de, "WSAECONNRESET", WSAECONNRESET, "Connection reset by peer");
738
#endif
739
#ifdef WSAGETSELECTERRO
740
    inscode(d, ds, de, "WSAGETSELECTERRO", WSAGETSELECTERRO, "Error WSAGETSELECTERRO");
741
#endif
742
#ifdef WSAETIMEDOUT
743
    inscode(d, ds, de, "WSAETIMEDOUT", WSAETIMEDOUT, "Connection timed out");
744
#endif
745
#ifdef WSAENOBUFS
746
    inscode(d, ds, de, "WSAENOBUFS", WSAENOBUFS, "No buffer space available");
747
#endif
748
#ifdef WSAEDISCON
749
    inscode(d, ds, de, "WSAEDISCON", WSAEDISCON, "Error WSAEDISCON");
750
#endif
751
#ifdef WSAEINTR
752
    inscode(d, ds, de, "WSAEINTR", WSAEINTR, "Interrupted system call");
753
#endif
754
#ifdef WSAEPROTOTYPE
755
    inscode(d, ds, de, "WSAEPROTOTYPE", WSAEPROTOTYPE, "Protocol wrong type for socket");
756
#endif
757
#ifdef WSAHOS
758
    inscode(d, ds, de, "WSAHOS", WSAHOS, "Error WSAHOS");
759
#endif
760
#ifdef WSAEADDRINUSE
761
    inscode(d, ds, de, "WSAEADDRINUSE", WSAEADDRINUSE, "Address already in use");
762
#endif
763
#ifdef WSAEADDRNOTAVAIL
764
    inscode(d, ds, de, "WSAEADDRNOTAVAIL", WSAEADDRNOTAVAIL, "Cannot assign requested address");
765
#endif
766
#ifdef WSAEALREADY
767
    inscode(d, ds, de, "WSAEALREADY", WSAEALREADY, "Operation already in progress");
768
#endif
769
#ifdef WSAEPROTONOSUPPORT
770
    inscode(d, ds, de, "WSAEPROTONOSUPPORT", WSAEPROTONOSUPPORT, "Protocol not supported");
771
#endif
772
#ifdef WSASYSNOTREADY
773
    inscode(d, ds, de, "WSASYSNOTREADY", WSASYSNOTREADY, "Error WSASYSNOTREADY");
774
#endif
775
#ifdef WSAEWOULDBLOCK
776
    inscode(d, ds, de, "WSAEWOULDBLOCK", WSAEWOULDBLOCK, "Operation would block");
777
#endif
778
#ifdef WSAEPFNOSUPPORT
779
    inscode(d, ds, de, "WSAEPFNOSUPPORT", WSAEPFNOSUPPORT, "Protocol family not supported");
780
#endif
781
#ifdef WSAEOPNOTSUPP
782
    inscode(d, ds, de, "WSAEOPNOTSUPP", WSAEOPNOTSUPP, "Operation not supported on transport endpoint");
783
#endif
784
#ifdef WSAEISCONN
785
    inscode(d, ds, de, "WSAEISCONN", WSAEISCONN, "Transport endpoint is already connected");
786
#endif
787
#ifdef WSAEDQUOT
788
    inscode(d, ds, de, "WSAEDQUOT", WSAEDQUOT, "Quota exceeded");
789
#endif
790
#ifdef WSAENOTCONN
791
    inscode(d, ds, de, "WSAENOTCONN", WSAENOTCONN, "Transport endpoint is not connected");
792
#endif
793
#ifdef WSAEREMOTE
794
    inscode(d, ds, de, "WSAEREMOTE", WSAEREMOTE, "Object is remote");
795
#endif
796
#ifdef WSAEINVAL
797
    inscode(d, ds, de, "WSAEINVAL", WSAEINVAL, "Invalid argument");
798
#endif
799
#ifdef WSAEINPROGRESS
800
    inscode(d, ds, de, "WSAEINPROGRESS", WSAEINPROGRESS, "Operation now in progress");
801
#endif
802
#ifdef WSAGETSELECTEVEN
803
    inscode(d, ds, de, "WSAGETSELECTEVEN", WSAGETSELECTEVEN, "Error WSAGETSELECTEVEN");
804
#endif
805
#ifdef WSAESOCKTNOSUPPORT
806
    inscode(d, ds, de, "WSAESOCKTNOSUPPORT", WSAESOCKTNOSUPPORT, "Socket type not supported");
807
#endif
808
#ifdef WSAGETASYNCERRO
809
    inscode(d, ds, de, "WSAGETASYNCERRO", WSAGETASYNCERRO, "Error WSAGETASYNCERRO");
810
#endif
811
#ifdef WSAMAKESELECTREPL
812
    inscode(d, ds, de, "WSAMAKESELECTREPL", WSAMAKESELECTREPL, "Error WSAMAKESELECTREPL");
813
#endif
814
#ifdef WSAGETASYNCBUFLE
815
    inscode(d, ds, de, "WSAGETASYNCBUFLE", WSAGETASYNCBUFLE, "Error WSAGETASYNCBUFLE");
816
#endif
817
#ifdef WSAEDESTADDRREQ
818
    inscode(d, ds, de, "WSAEDESTADDRREQ", WSAEDESTADDRREQ, "Destination address required");
819
#endif
820
#ifdef WSAECONNREFUSED
821
    inscode(d, ds, de, "WSAECONNREFUSED", WSAECONNREFUSED, "Connection refused");
822
#endif
823
#ifdef WSAENETRESET
824
    inscode(d, ds, de, "WSAENETRESET", WSAENETRESET, "Network dropped connection because of reset");
825
#endif
826
#ifdef WSAN
827
    inscode(d, ds, de, "WSAN", WSAN, "Error WSAN");
828
#endif
829
0
#ifdef ENOMEDIUM
830
0
    inscode(d, ds, de, "ENOMEDIUM", ENOMEDIUM, "No medium found");
831
0
#endif
832
0
#ifdef EMEDIUMTYPE
833
0
    inscode(d, ds, de, "EMEDIUMTYPE", EMEDIUMTYPE, "Wrong medium type");
834
0
#endif
835
0
#ifdef ECANCELED
836
0
    inscode(d, ds, de, "ECANCELED", ECANCELED, "Operation Canceled");
837
0
#endif
838
0
#ifdef ENOKEY
839
0
    inscode(d, ds, de, "ENOKEY", ENOKEY, "Required key not available");
840
0
#endif
841
0
#ifdef EKEYEXPIRED
842
0
    inscode(d, ds, de, "EKEYEXPIRED", EKEYEXPIRED, "Key has expired");
843
0
#endif
844
0
#ifdef EKEYREVOKED
845
0
    inscode(d, ds, de, "EKEYREVOKED", EKEYREVOKED, "Key has been revoked");
846
0
#endif
847
0
#ifdef EKEYREJECTED
848
0
    inscode(d, ds, de, "EKEYREJECTED", EKEYREJECTED, "Key was rejected by service");
849
0
#endif
850
0
#ifdef EOWNERDEAD
851
0
    inscode(d, ds, de, "EOWNERDEAD", EOWNERDEAD, "Owner died");
852
0
#endif
853
0
#ifdef ENOTRECOVERABLE
854
0
    inscode(d, ds, de, "ENOTRECOVERABLE", ENOTRECOVERABLE, "State not recoverable");
855
0
#endif
856
0
#ifdef ERFKILL
857
0
    inscode(d, ds, de, "ERFKILL", ERFKILL, "Operation not possible due to RF-kill");
858
0
#endif
859
860
    /* Solaris-specific errnos */
861
0
#ifdef ECANCELED
862
0
    inscode(d, ds, de, "ECANCELED", ECANCELED, "Operation canceled");
863
0
#endif
864
0
#ifdef ENOTSUP
865
0
    inscode(d, ds, de, "ENOTSUP", ENOTSUP, "Operation not supported");
866
0
#endif
867
0
#ifdef EOWNERDEAD
868
0
    inscode(d, ds, de, "EOWNERDEAD", EOWNERDEAD, "Process died with the lock");
869
0
#endif
870
0
#ifdef ENOTRECOVERABLE
871
0
    inscode(d, ds, de, "ENOTRECOVERABLE", ENOTRECOVERABLE, "Lock is not recoverable");
872
0
#endif
873
#ifdef ELOCKUNMAPPED
874
    inscode(d, ds, de, "ELOCKUNMAPPED", ELOCKUNMAPPED, "Locked lock was unmapped");
875
#endif
876
#ifdef ENOTACTIVE
877
    inscode(d, ds, de, "ENOTACTIVE", ENOTACTIVE, "Facility is not active");
878
#endif
879
880
    /* MacOSX specific errnos */
881
#ifdef EAUTH
882
    inscode(d, ds, de, "EAUTH", EAUTH, "Authentication error");
883
#endif
884
#ifdef EBADARCH
885
    inscode(d, ds, de, "EBADARCH", EBADARCH, "Bad CPU type in executable");
886
#endif
887
#ifdef EBADEXEC
888
    inscode(d, ds, de, "EBADEXEC", EBADEXEC, "Bad executable (or shared library)");
889
#endif
890
#ifdef EBADMACHO
891
    inscode(d, ds, de, "EBADMACHO", EBADMACHO, "Malformed Mach-o file");
892
#endif
893
#ifdef EBADRPC
894
    inscode(d, ds, de, "EBADRPC", EBADRPC, "RPC struct is bad");
895
#endif
896
#ifdef EDEVERR
897
    inscode(d, ds, de, "EDEVERR", EDEVERR, "Device error");
898
#endif
899
#ifdef EFTYPE
900
    inscode(d, ds, de, "EFTYPE", EFTYPE, "Inappropriate file type or format");
901
#endif
902
#ifdef ENEEDAUTH
903
    inscode(d, ds, de, "ENEEDAUTH", ENEEDAUTH, "Need authenticator");
904
#endif
905
#ifdef ENOATTR
906
    inscode(d, ds, de, "ENOATTR", ENOATTR, "Attribute not found");
907
#endif
908
#ifdef ENOPOLICY
909
    inscode(d, ds, de, "ENOPOLICY", ENOPOLICY, "Policy not found");
910
#endif
911
#ifdef EPROCLIM
912
    inscode(d, ds, de, "EPROCLIM", EPROCLIM, "Too many processes");
913
#endif
914
#ifdef EPROCUNAVAIL
915
    inscode(d, ds, de, "EPROCUNAVAIL", EPROCUNAVAIL, "Bad procedure for program");
916
#endif
917
#ifdef EPROGMISMATCH
918
    inscode(d, ds, de, "EPROGMISMATCH", EPROGMISMATCH, "Program version wrong");
919
#endif
920
#ifdef EPROGUNAVAIL
921
    inscode(d, ds, de, "EPROGUNAVAIL", EPROGUNAVAIL, "RPC prog. not avail");
922
#endif
923
#ifdef EPWROFF
924
    inscode(d, ds, de, "EPWROFF", EPWROFF, "Device power is off");
925
#endif
926
#ifdef ERPCMISMATCH
927
    inscode(d, ds, de, "ERPCMISMATCH", ERPCMISMATCH, "RPC version wrong");
928
#endif
929
#ifdef ESHLIBVERS
930
    inscode(d, ds, de, "ESHLIBVERS", ESHLIBVERS, "Shared library version mismatch");
931
#endif
932
933
0
    Py_DECREF(de);
934
0
    return m;
935
0
}