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