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