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