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