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