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