errnomodule.c 23.2 KB
Newer Older
1 2 3 4 5

/* Errno module */

#include "Python.h"

6 7 8 9 10
/* Mac with GUSI has more errors than those in errno.h */
#ifdef USE_GUSI
#include <sys/errno.h>
#endif

11
/* Windows socket errors (WSA*)  */
12 13 14 15
#ifdef MS_WINDOWS
#include <winsock.h>
#endif

16 17 18 19 20
/*
 * Pull in the system error definitions
 */ 

static PyMethodDef errno_methods[] = {
21
	{NULL,	      	NULL}
22 23
};

24
/* Helper function doing the dictionary inserting */
25 26

static void
Fredrik Lundh's avatar
Fredrik Lundh committed
27
_inscode(PyObject *d, PyObject *de, char *name, int code)
28
{
29 30 31 32 33 34 35 36
	PyObject *u = PyString_FromString(name);
	PyObject *v = PyInt_FromLong((long) code);

	/* Don't bother checking for errors; they'll be caught at the end
	 * of the module initialization function by the caller of
	 * initerrno().
	 */
	if (u && v) {
37 38 39
		/* insert in modules dict */
		PyDict_SetItem(d, u, v);
		/* insert in errorcode dict */
40
		PyDict_SetItem(de, v, u);
41
	}
42 43
	Py_XDECREF(u);
	Py_XDECREF(v);
44 45
}

46
PyDoc_STRVAR(errno__doc__,
47 48 49 50 51 52 53 54 55 56 57
"This module makes available standard errno system symbols.\n\
\n\
The value of each symbol is the corresponding integer value,\n\
e.g., on most systems, errno.ENOENT equals the integer 2.\n\
\n\
The dictionary errno.errorcode maps numeric codes to symbol names,\n\
e.g., errno.errorcode[2] could be the string 'ENOENT'.\n\
\n\
Symbols that are not relevant to the underlying system are not defined.\n\
\n\
To map error codes to error messages, use the function os.strerror(),\n\
58
e.g. os.strerror(2) could return 'No such file or directory'.");
59

60
PyMODINIT_FUNC
61
initerrno(void)
62
{
63
	PyObject *m, *d, *de;
64
	m = Py_InitModule3("errno", errno_methods, errno__doc__);
65
	d = PyModule_GetDict(m);
66
	de = PyDict_New();
67 68
	if (!d || !de || PyDict_SetItemString(d, "errorcode", de) < 0)
		return;
69

70 71 72
/* Macro so I don't have to edit each and every line below... */
#define inscode(d, ds, de, name, code, comment) _inscode(d, de, name, code)

73 74 75 76 77
	/*
	 * The names and comments are borrowed from linux/include/errno.h,
	 * which should be pretty all-inclusive
	 */ 

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

790
	Py_DECREF(de);
791
}