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