~ubuntu-branches/ubuntu/maverick/python3.1/maverick

« back to all changes in this revision

Viewing changes to Modules/errnomodule.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-03-23 00:01:27 UTC
  • Revision ID: james.westby@ubuntu.com-20090323000127-5fstfxju4ufrhthq
Tags: upstream-3.1~a1+20090322
ImportĀ upstreamĀ versionĀ 3.1~a1+20090322

Show diffs side-by-side

added added

removed removed

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