/Modules/errnomodule.c

http://unladen-swallow.googlecode.com/ · C · 788 lines · 757 code · 14 blank · 17 comment · 7 complexity · ee7b1fafefd8d8177464d26934ca3f40 MD5 · raw file

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