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