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