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