AppPkg/Applications/Python: Get Python startup process fully working for EDK II.
AppPkg.dsc: Clean up and add Socket support. Applications/Python/PythonCore.inf: Re-order source files. Applications/Python/Efi/config.c: Add all mandatory modules. Disable remaining. Applications/Python/Efi/edk2module.c: EDK II port of posixmodule.c. Applications/Python/Efi/getpath.c: Determine initial module search path. Applications/Python/Ia32/pyconfig.h: Configuration macros for Ia32. Applications/Python/Ipf/pyconfig.h: Configuration macros for Ipf. Applications/Python/PyMod-2.7.2/Include/osdefs.h: Select appropriate directory and path separators for UEFI. Applications/Python/PyMod-2.7.2/Lib/ntpath.py: Allow multi-character device names to left of colon. Applications/Python/PyMod-2.7.2/Lib/os.py: Add edk2 as a supported OS. Applications/Python/PyMod-2.7.2/Lib/site.py: UEFI-specific path and environment setup. Applications/Python/PyMod-2.7.2/Modules/errnomodule.c: Sync with errno.h. Applications/Python/PyMod-2.7.2/Modules/selectmodule.c: Add UEFI support. Applications/Python/PyMod-2.7.2/Modules/socketmodule.h: Add UEFI support. Applications/Python/PyMod-2.7.2/Modules/zlib/zutil.h: Add UEFI support. Applications/Python/PyMod-2.7.2/Python/getcopyright.c: Add Intel copyright. Applications/Python/X64/pyconfig.h: Configuration macros for X64. Signed-off-by: darylm503 Reviewed-by: geekboy15a Reviewed-by: jljusten Reviewed-by: lpleahy Reviewed-by: leegrosenbaum git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12957 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
845
AppPkg/Applications/Python/PyMod-2.7.2/Modules/errnomodule.c
Normal file
845
AppPkg/Applications/Python/PyMod-2.7.2/Modules/errnomodule.c
Normal file
@@ -0,0 +1,845 @@
|
||||
|
||||
/* Errno module
|
||||
|
||||
Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that accompanies this distribution.
|
||||
The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
*/
|
||||
|
||||
#include "Python.h"
|
||||
|
||||
/* Windows socket errors (WSA*) */
|
||||
#ifdef MS_WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Pull in the system error definitions
|
||||
*/
|
||||
|
||||
static PyMethodDef errno_methods[] = {
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
/* Helper function doing the dictionary inserting */
|
||||
|
||||
static void
|
||||
_inscode(PyObject *d, PyObject *de, char *name, int code)
|
||||
{
|
||||
PyObject *u = PyString_FromString(name);
|
||||
PyObject *v = PyInt_FromLong((long) code);
|
||||
|
||||
/* Don't bother checking for errors; they'll be caught at the end
|
||||
* of the module initialization function by the caller of
|
||||
* initerrno().
|
||||
*/
|
||||
if (u && v) {
|
||||
/* insert in modules dict */
|
||||
PyDict_SetItem(d, u, v);
|
||||
/* insert in errorcode dict */
|
||||
PyDict_SetItem(de, v, u);
|
||||
}
|
||||
Py_XDECREF(u);
|
||||
Py_XDECREF(v);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(errno__doc__,
|
||||
"This module makes available standard errno system symbols.\n\
|
||||
\n\
|
||||
The value of each symbol is the corresponding integer value,\n\
|
||||
e.g., on most systems, errno.ENOENT equals the integer 2.\n\
|
||||
\n\
|
||||
The dictionary errno.errorcode maps numeric codes to symbol names,\n\
|
||||
e.g., errno.errorcode[2] could be the string 'ENOENT'.\n\
|
||||
\n\
|
||||
Symbols that are not relevant to the underlying system are not defined.\n\
|
||||
\n\
|
||||
To map error codes to error messages, use the function os.strerror(),\n\
|
||||
e.g. os.strerror(2) could return 'No such file or directory'.");
|
||||
|
||||
PyMODINIT_FUNC
|
||||
initerrno(void)
|
||||
{
|
||||
PyObject *m, *d, *de;
|
||||
m = Py_InitModule3("errno", errno_methods, errno__doc__);
|
||||
if (m == NULL)
|
||||
return;
|
||||
d = PyModule_GetDict(m);
|
||||
de = PyDict_New();
|
||||
if (!d || !de || PyDict_SetItemString(d, "errorcode", de) < 0)
|
||||
return;
|
||||
|
||||
/* Macro so I don't have to edit each and every line below... */
|
||||
#define inscode(d, ds, de, name, code, comment) _inscode(d, de, name, code)
|
||||
|
||||
/*
|
||||
* The names and comments are borrowed from linux/include/errno.h,
|
||||
* which should be pretty all-inclusive
|
||||
*/
|
||||
|
||||
#ifdef ENODEV
|
||||
inscode(d, ds, de, "ENODEV", ENODEV, "No such device");
|
||||
#endif
|
||||
#ifdef ENOCSI
|
||||
inscode(d, ds, de, "ENOCSI", ENOCSI, "No CSI structure available");
|
||||
#endif
|
||||
#ifdef EHOSTUNREACH
|
||||
inscode(d, ds, de, "EHOSTUNREACH", EHOSTUNREACH, "No route to host");
|
||||
#else
|
||||
#ifdef WSAEHOSTUNREACH
|
||||
inscode(d, ds, de, "EHOSTUNREACH", WSAEHOSTUNREACH, "No route to host");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ENOMSG
|
||||
inscode(d, ds, de, "ENOMSG", ENOMSG, "No message of desired type");
|
||||
#endif
|
||||
#ifdef EUCLEAN
|
||||
inscode(d, ds, de, "EUCLEAN", EUCLEAN, "Structure needs cleaning");
|
||||
#endif
|
||||
#ifdef EL2NSYNC
|
||||
inscode(d, ds, de, "EL2NSYNC", EL2NSYNC, "Level 2 not synchronized");
|
||||
#endif
|
||||
#ifdef EL2HLT
|
||||
inscode(d, ds, de, "EL2HLT", EL2HLT, "Level 2 halted");
|
||||
#endif
|
||||
#ifdef ENODATA
|
||||
inscode(d, ds, de, "ENODATA", ENODATA, "No data available");
|
||||
#endif
|
||||
#ifdef ENOTBLK
|
||||
inscode(d, ds, de, "ENOTBLK", ENOTBLK, "Block device required");
|
||||
#endif
|
||||
#ifdef ENOSYS
|
||||
inscode(d, ds, de, "ENOSYS", ENOSYS, "Function not implemented");
|
||||
#endif
|
||||
#ifdef EPIPE
|
||||
inscode(d, ds, de, "EPIPE", EPIPE, "Broken pipe");
|
||||
#endif
|
||||
#ifdef EINVAL
|
||||
inscode(d, ds, de, "EINVAL", EINVAL, "Invalid argument");
|
||||
#else
|
||||
#ifdef WSAEINVAL
|
||||
inscode(d, ds, de, "EINVAL", WSAEINVAL, "Invalid argument");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef EOVERFLOW
|
||||
inscode(d, ds, de, "EOVERFLOW", EOVERFLOW, "Value too large for defined data type");
|
||||
#endif
|
||||
#ifdef EADV
|
||||
inscode(d, ds, de, "EADV", EADV, "Advertise error");
|
||||
#endif
|
||||
#ifdef EINTR
|
||||
inscode(d, ds, de, "EINTR", EINTR, "Interrupted system call");
|
||||
#else
|
||||
#ifdef WSAEINTR
|
||||
inscode(d, ds, de, "EINTR", WSAEINTR, "Interrupted system call");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef EUSERS
|
||||
inscode(d, ds, de, "EUSERS", EUSERS, "Too many users");
|
||||
#else
|
||||
#ifdef WSAEUSERS
|
||||
inscode(d, ds, de, "EUSERS", WSAEUSERS, "Too many users");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ENOTEMPTY
|
||||
inscode(d, ds, de, "ENOTEMPTY", ENOTEMPTY, "Directory not empty");
|
||||
#else
|
||||
#ifdef WSAENOTEMPTY
|
||||
inscode(d, ds, de, "ENOTEMPTY", WSAENOTEMPTY, "Directory not empty");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ENOBUFS
|
||||
inscode(d, ds, de, "ENOBUFS", ENOBUFS, "No buffer space available");
|
||||
#else
|
||||
#ifdef WSAENOBUFS
|
||||
inscode(d, ds, de, "ENOBUFS", WSAENOBUFS, "No buffer space available");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef EPROTO
|
||||
inscode(d, ds, de, "EPROTO", EPROTO, "Protocol error");
|
||||
#endif
|
||||
#ifdef EREMOTE
|
||||
inscode(d, ds, de, "EREMOTE", EREMOTE, "Object is remote");
|
||||
#else
|
||||
#ifdef WSAEREMOTE
|
||||
inscode(d, ds, de, "EREMOTE", WSAEREMOTE, "Object is remote");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ENAVAIL
|
||||
inscode(d, ds, de, "ENAVAIL", ENAVAIL, "No XENIX semaphores available");
|
||||
#endif
|
||||
#ifdef ECHILD
|
||||
inscode(d, ds, de, "ECHILD", ECHILD, "No child processes");
|
||||
#endif
|
||||
#ifdef ELOOP
|
||||
inscode(d, ds, de, "ELOOP", ELOOP, "Too many symbolic links encountered");
|
||||
#else
|
||||
#ifdef WSAELOOP
|
||||
inscode(d, ds, de, "ELOOP", WSAELOOP, "Too many symbolic links encountered");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef EXDEV
|
||||
inscode(d, ds, de, "EXDEV", EXDEV, "Cross-device link");
|
||||
#endif
|
||||
#ifdef E2BIG
|
||||
inscode(d, ds, de, "E2BIG", E2BIG, "Arg list too long");
|
||||
#endif
|
||||
#ifdef ESRCH
|
||||
inscode(d, ds, de, "ESRCH", ESRCH, "No such process");
|
||||
#endif
|
||||
#ifdef EMSGSIZE
|
||||
inscode(d, ds, de, "EMSGSIZE", EMSGSIZE, "Message too long");
|
||||
#else
|
||||
#ifdef WSAEMSGSIZE
|
||||
inscode(d, ds, de, "EMSGSIZE", WSAEMSGSIZE, "Message too long");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef EAFNOSUPPORT
|
||||
inscode(d, ds, de, "EAFNOSUPPORT", EAFNOSUPPORT, "Address family not supported by protocol");
|
||||
#else
|
||||
#ifdef WSAEAFNOSUPPORT
|
||||
inscode(d, ds, de, "EAFNOSUPPORT", WSAEAFNOSUPPORT, "Address family not supported by protocol");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef EBADR
|
||||
inscode(d, ds, de, "EBADR", EBADR, "Invalid request descriptor");
|
||||
#endif
|
||||
#ifdef EHOSTDOWN
|
||||
inscode(d, ds, de, "EHOSTDOWN", EHOSTDOWN, "Host is down");
|
||||
#else
|
||||
#ifdef WSAEHOSTDOWN
|
||||
inscode(d, ds, de, "EHOSTDOWN", WSAEHOSTDOWN, "Host is down");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef EPFNOSUPPORT
|
||||
inscode(d, ds, de, "EPFNOSUPPORT", EPFNOSUPPORT, "Protocol family not supported");
|
||||
#else
|
||||
#ifdef WSAEPFNOSUPPORT
|
||||
inscode(d, ds, de, "EPFNOSUPPORT", WSAEPFNOSUPPORT, "Protocol family not supported");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ENOPROTOOPT
|
||||
inscode(d, ds, de, "ENOPROTOOPT", ENOPROTOOPT, "Protocol not available");
|
||||
#else
|
||||
#ifdef WSAENOPROTOOPT
|
||||
inscode(d, ds, de, "ENOPROTOOPT", WSAENOPROTOOPT, "Protocol not available");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef EBUSY
|
||||
inscode(d, ds, de, "EBUSY", EBUSY, "Device or resource busy");
|
||||
#endif
|
||||
#ifdef EWOULDBLOCK
|
||||
inscode(d, ds, de, "EWOULDBLOCK", EWOULDBLOCK, "Operation would block");
|
||||
#else
|
||||
#ifdef WSAEWOULDBLOCK
|
||||
inscode(d, ds, de, "EWOULDBLOCK", WSAEWOULDBLOCK, "Operation would block");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef EBADFD
|
||||
inscode(d, ds, de, "EBADFD", EBADFD, "File descriptor in bad state");
|
||||
#endif
|
||||
#ifdef EDOTDOT
|
||||
inscode(d, ds, de, "EDOTDOT", EDOTDOT, "RFS specific error");
|
||||
#endif
|
||||
#ifdef EISCONN
|
||||
inscode(d, ds, de, "EISCONN", EISCONN, "Transport endpoint is already connected");
|
||||
#else
|
||||
#ifdef WSAEISCONN
|
||||
inscode(d, ds, de, "EISCONN", WSAEISCONN, "Transport endpoint is already connected");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ENOANO
|
||||
inscode(d, ds, de, "ENOANO", ENOANO, "No anode");
|
||||
#endif
|
||||
#ifdef ESHUTDOWN
|
||||
inscode(d, ds, de, "ESHUTDOWN", ESHUTDOWN, "Cannot send after transport endpoint shutdown");
|
||||
#else
|
||||
#ifdef WSAESHUTDOWN
|
||||
inscode(d, ds, de, "ESHUTDOWN", WSAESHUTDOWN, "Cannot send after transport endpoint shutdown");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ECHRNG
|
||||
inscode(d, ds, de, "ECHRNG", ECHRNG, "Channel number out of range");
|
||||
#endif
|
||||
#ifdef ELIBBAD
|
||||
inscode(d, ds, de, "ELIBBAD", ELIBBAD, "Accessing a corrupted shared library");
|
||||
#endif
|
||||
#ifdef ENONET
|
||||
inscode(d, ds, de, "ENONET", ENONET, "Machine is not on the network");
|
||||
#endif
|
||||
#ifdef EBADE
|
||||
inscode(d, ds, de, "EBADE", EBADE, "Invalid exchange");
|
||||
#endif
|
||||
#ifdef EBADF
|
||||
inscode(d, ds, de, "EBADF", EBADF, "Bad file number");
|
||||
#else
|
||||
#ifdef WSAEBADF
|
||||
inscode(d, ds, de, "EBADF", WSAEBADF, "Bad file number");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef EMULTIHOP
|
||||
inscode(d, ds, de, "EMULTIHOP", EMULTIHOP, "Multihop attempted");
|
||||
#endif
|
||||
#ifdef EIO
|
||||
inscode(d, ds, de, "EIO", EIO, "I/O error");
|
||||
#endif
|
||||
#ifdef EUNATCH
|
||||
inscode(d, ds, de, "EUNATCH", EUNATCH, "Protocol driver not attached");
|
||||
#endif
|
||||
#ifdef EPROTOTYPE
|
||||
inscode(d, ds, de, "EPROTOTYPE", EPROTOTYPE, "Protocol wrong type for socket");
|
||||
#else
|
||||
#ifdef WSAEPROTOTYPE
|
||||
inscode(d, ds, de, "EPROTOTYPE", WSAEPROTOTYPE, "Protocol wrong type for socket");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ENOSPC
|
||||
inscode(d, ds, de, "ENOSPC", ENOSPC, "No space left on device");
|
||||
#endif
|
||||
#ifdef ENOEXEC
|
||||
inscode(d, ds, de, "ENOEXEC", ENOEXEC, "Exec format error");
|
||||
#endif
|
||||
#ifdef EALREADY
|
||||
inscode(d, ds, de, "EALREADY", EALREADY, "Operation already in progress");
|
||||
#else
|
||||
#ifdef WSAEALREADY
|
||||
inscode(d, ds, de, "EALREADY", WSAEALREADY, "Operation already in progress");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ENETDOWN
|
||||
inscode(d, ds, de, "ENETDOWN", ENETDOWN, "Network is down");
|
||||
#else
|
||||
#ifdef WSAENETDOWN
|
||||
inscode(d, ds, de, "ENETDOWN", WSAENETDOWN, "Network is down");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ENOTNAM
|
||||
inscode(d, ds, de, "ENOTNAM", ENOTNAM, "Not a XENIX named type file");
|
||||
#endif
|
||||
#ifdef EACCES
|
||||
inscode(d, ds, de, "EACCES", EACCES, "Permission denied");
|
||||
#else
|
||||
#ifdef WSAEACCES
|
||||
inscode(d, ds, de, "EACCES", WSAEACCES, "Permission denied");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ELNRNG
|
||||
inscode(d, ds, de, "ELNRNG", ELNRNG, "Link number out of range");
|
||||
#endif
|
||||
#ifdef EILSEQ
|
||||
inscode(d, ds, de, "EILSEQ", EILSEQ, "Illegal byte sequence");
|
||||
#endif
|
||||
#ifdef ENOTDIR
|
||||
inscode(d, ds, de, "ENOTDIR", ENOTDIR, "Not a directory");
|
||||
#endif
|
||||
#ifdef ENOTUNIQ
|
||||
inscode(d, ds, de, "ENOTUNIQ", ENOTUNIQ, "Name not unique on network");
|
||||
#endif
|
||||
#ifdef EPERM
|
||||
inscode(d, ds, de, "EPERM", EPERM, "Operation not permitted");
|
||||
#endif
|
||||
#ifdef EDOM
|
||||
inscode(d, ds, de, "EDOM", EDOM, "Math argument out of domain of func");
|
||||
#endif
|
||||
#ifdef EXFULL
|
||||
inscode(d, ds, de, "EXFULL", EXFULL, "Exchange full");
|
||||
#endif
|
||||
#ifdef ECONNREFUSED
|
||||
inscode(d, ds, de, "ECONNREFUSED", ECONNREFUSED, "Connection refused");
|
||||
#else
|
||||
#ifdef WSAECONNREFUSED
|
||||
inscode(d, ds, de, "ECONNREFUSED", WSAECONNREFUSED, "Connection refused");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef EISDIR
|
||||
inscode(d, ds, de, "EISDIR", EISDIR, "Is a directory");
|
||||
#endif
|
||||
#ifdef EPROTONOSUPPORT
|
||||
inscode(d, ds, de, "EPROTONOSUPPORT", EPROTONOSUPPORT, "Protocol not supported");
|
||||
#else
|
||||
#ifdef WSAEPROTONOSUPPORT
|
||||
inscode(d, ds, de, "EPROTONOSUPPORT", WSAEPROTONOSUPPORT, "Protocol not supported");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef EROFS
|
||||
inscode(d, ds, de, "EROFS", EROFS, "Read-only file system");
|
||||
#endif
|
||||
#ifdef EADDRNOTAVAIL
|
||||
inscode(d, ds, de, "EADDRNOTAVAIL", EADDRNOTAVAIL, "Cannot assign requested address");
|
||||
#else
|
||||
#ifdef WSAEADDRNOTAVAIL
|
||||
inscode(d, ds, de, "EADDRNOTAVAIL", WSAEADDRNOTAVAIL, "Cannot assign requested address");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef EIDRM
|
||||
inscode(d, ds, de, "EIDRM", EIDRM, "Identifier removed");
|
||||
#endif
|
||||
#ifdef ECOMM
|
||||
inscode(d, ds, de, "ECOMM", ECOMM, "Communication error on send");
|
||||
#endif
|
||||
#ifdef ESRMNT
|
||||
inscode(d, ds, de, "ESRMNT", ESRMNT, "Srmount error");
|
||||
#endif
|
||||
#ifdef EREMOTEIO
|
||||
inscode(d, ds, de, "EREMOTEIO", EREMOTEIO, "Remote I/O error");
|
||||
#endif
|
||||
#ifdef EL3RST
|
||||
inscode(d, ds, de, "EL3RST", EL3RST, "Level 3 reset");
|
||||
#endif
|
||||
#ifdef EBADMSG
|
||||
inscode(d, ds, de, "EBADMSG", EBADMSG, "Not a data message");
|
||||
#endif
|
||||
#ifdef ENFILE
|
||||
inscode(d, ds, de, "ENFILE", ENFILE, "File table overflow");
|
||||
#endif
|
||||
#ifdef ELIBMAX
|
||||
inscode(d, ds, de, "ELIBMAX", ELIBMAX, "Attempting to link in too many shared libraries");
|
||||
#endif
|
||||
#ifdef ESPIPE
|
||||
inscode(d, ds, de, "ESPIPE", ESPIPE, "Illegal seek");
|
||||
#endif
|
||||
#ifdef ENOLINK
|
||||
inscode(d, ds, de, "ENOLINK", ENOLINK, "Link has been severed");
|
||||
#endif
|
||||
#ifdef ENETRESET
|
||||
inscode(d, ds, de, "ENETRESET", ENETRESET, "Network dropped connection because of reset");
|
||||
#else
|
||||
#ifdef WSAENETRESET
|
||||
inscode(d, ds, de, "ENETRESET", WSAENETRESET, "Network dropped connection because of reset");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ETIMEDOUT
|
||||
inscode(d, ds, de, "ETIMEDOUT", ETIMEDOUT, "Connection timed out");
|
||||
#else
|
||||
#ifdef WSAETIMEDOUT
|
||||
inscode(d, ds, de, "ETIMEDOUT", WSAETIMEDOUT, "Connection timed out");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ENOENT
|
||||
inscode(d, ds, de, "ENOENT", ENOENT, "No such file or directory");
|
||||
#endif
|
||||
#ifdef EEXIST
|
||||
inscode(d, ds, de, "EEXIST", EEXIST, "File exists");
|
||||
#endif
|
||||
#ifdef EDQUOT
|
||||
inscode(d, ds, de, "EDQUOT", EDQUOT, "Quota exceeded");
|
||||
#else
|
||||
#ifdef WSAEDQUOT
|
||||
inscode(d, ds, de, "EDQUOT", WSAEDQUOT, "Quota exceeded");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ENOSTR
|
||||
inscode(d, ds, de, "ENOSTR", ENOSTR, "Device not a stream");
|
||||
#endif
|
||||
#ifdef EBADSLT
|
||||
inscode(d, ds, de, "EBADSLT", EBADSLT, "Invalid slot");
|
||||
#endif
|
||||
#ifdef EBADRQC
|
||||
inscode(d, ds, de, "EBADRQC", EBADRQC, "Invalid request code");
|
||||
#endif
|
||||
#ifdef ELIBACC
|
||||
inscode(d, ds, de, "ELIBACC", ELIBACC, "Can not access a needed shared library");
|
||||
#endif
|
||||
#ifdef EFAULT
|
||||
inscode(d, ds, de, "EFAULT", EFAULT, "Bad address");
|
||||
#else
|
||||
#ifdef WSAEFAULT
|
||||
inscode(d, ds, de, "EFAULT", WSAEFAULT, "Bad address");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef EFBIG
|
||||
inscode(d, ds, de, "EFBIG", EFBIG, "File too large");
|
||||
#endif
|
||||
#ifdef EDEADLK
|
||||
inscode(d, ds, de, "EDEADLK", EDEADLK, "Resource deadlock would occur");
|
||||
#endif
|
||||
#ifdef ENOTCONN
|
||||
inscode(d, ds, de, "ENOTCONN", ENOTCONN, "Transport endpoint is not connected");
|
||||
#else
|
||||
#ifdef WSAENOTCONN
|
||||
inscode(d, ds, de, "ENOTCONN", WSAENOTCONN, "Transport endpoint is not connected");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef EDESTADDRREQ
|
||||
inscode(d, ds, de, "EDESTADDRREQ", EDESTADDRREQ, "Destination address required");
|
||||
#else
|
||||
#ifdef WSAEDESTADDRREQ
|
||||
inscode(d, ds, de, "EDESTADDRREQ", WSAEDESTADDRREQ, "Destination address required");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ELIBSCN
|
||||
inscode(d, ds, de, "ELIBSCN", ELIBSCN, ".lib section in a.out corrupted");
|
||||
#endif
|
||||
#ifdef ENOLCK
|
||||
inscode(d, ds, de, "ENOLCK", ENOLCK, "No record locks available");
|
||||
#endif
|
||||
#ifdef EISNAM
|
||||
inscode(d, ds, de, "EISNAM", EISNAM, "Is a named type file");
|
||||
#endif
|
||||
#ifdef ECONNABORTED
|
||||
inscode(d, ds, de, "ECONNABORTED", ECONNABORTED, "Software caused connection abort");
|
||||
#else
|
||||
#ifdef WSAECONNABORTED
|
||||
inscode(d, ds, de, "ECONNABORTED", WSAECONNABORTED, "Software caused connection abort");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ENETUNREACH
|
||||
inscode(d, ds, de, "ENETUNREACH", ENETUNREACH, "Network is unreachable");
|
||||
#else
|
||||
#ifdef WSAENETUNREACH
|
||||
inscode(d, ds, de, "ENETUNREACH", WSAENETUNREACH, "Network is unreachable");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ESTALE
|
||||
inscode(d, ds, de, "ESTALE", ESTALE, "Stale NFS file handle");
|
||||
#else
|
||||
#ifdef WSAESTALE
|
||||
inscode(d, ds, de, "ESTALE", WSAESTALE, "Stale NFS file handle");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ENOSR
|
||||
inscode(d, ds, de, "ENOSR", ENOSR, "Out of streams resources");
|
||||
#endif
|
||||
#ifdef ENOMEM
|
||||
inscode(d, ds, de, "ENOMEM", ENOMEM, "Out of memory");
|
||||
#endif
|
||||
#ifdef ENOTSOCK
|
||||
inscode(d, ds, de, "ENOTSOCK", ENOTSOCK, "Socket operation on non-socket");
|
||||
#else
|
||||
#ifdef WSAENOTSOCK
|
||||
inscode(d, ds, de, "ENOTSOCK", WSAENOTSOCK, "Socket operation on non-socket");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ESTRPIPE
|
||||
inscode(d, ds, de, "ESTRPIPE", ESTRPIPE, "Streams pipe error");
|
||||
#endif
|
||||
#ifdef EMLINK
|
||||
inscode(d, ds, de, "EMLINK", EMLINK, "Too many links");
|
||||
#endif
|
||||
#ifdef ERANGE
|
||||
inscode(d, ds, de, "ERANGE", ERANGE, "Math result not representable");
|
||||
#endif
|
||||
#ifdef ELIBEXEC
|
||||
inscode(d, ds, de, "ELIBEXEC", ELIBEXEC, "Cannot exec a shared library directly");
|
||||
#endif
|
||||
#ifdef EL3HLT
|
||||
inscode(d, ds, de, "EL3HLT", EL3HLT, "Level 3 halted");
|
||||
#endif
|
||||
#ifdef ECONNRESET
|
||||
inscode(d, ds, de, "ECONNRESET", ECONNRESET, "Connection reset by peer");
|
||||
#else
|
||||
#ifdef WSAECONNRESET
|
||||
inscode(d, ds, de, "ECONNRESET", WSAECONNRESET, "Connection reset by peer");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef EADDRINUSE
|
||||
inscode(d, ds, de, "EADDRINUSE", EADDRINUSE, "Address already in use");
|
||||
#else
|
||||
#ifdef WSAEADDRINUSE
|
||||
inscode(d, ds, de, "EADDRINUSE", WSAEADDRINUSE, "Address already in use");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef EOPNOTSUPP
|
||||
inscode(d, ds, de, "EOPNOTSUPP", EOPNOTSUPP, "Operation not supported on transport endpoint");
|
||||
#else
|
||||
#ifdef WSAEOPNOTSUPP
|
||||
inscode(d, ds, de, "EOPNOTSUPP", WSAEOPNOTSUPP, "Operation not supported on transport endpoint");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef EREMCHG
|
||||
inscode(d, ds, de, "EREMCHG", EREMCHG, "Remote address changed");
|
||||
#endif
|
||||
#ifdef EAGAIN
|
||||
inscode(d, ds, de, "EAGAIN", EAGAIN, "Try again");
|
||||
#endif
|
||||
#ifdef ENAMETOOLONG
|
||||
inscode(d, ds, de, "ENAMETOOLONG", ENAMETOOLONG, "File name too long");
|
||||
#else
|
||||
#ifdef WSAENAMETOOLONG
|
||||
inscode(d, ds, de, "ENAMETOOLONG", WSAENAMETOOLONG, "File name too long");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ENOTTY
|
||||
inscode(d, ds, de, "ENOTTY", ENOTTY, "Not a typewriter");
|
||||
#endif
|
||||
#ifdef ERESTART
|
||||
inscode(d, ds, de, "ERESTART", ERESTART, "Interrupted system call should be restarted");
|
||||
#endif
|
||||
#ifdef ESOCKTNOSUPPORT
|
||||
inscode(d, ds, de, "ESOCKTNOSUPPORT", ESOCKTNOSUPPORT, "Socket type not supported");
|
||||
#else
|
||||
#ifdef WSAESOCKTNOSUPPORT
|
||||
inscode(d, ds, de, "ESOCKTNOSUPPORT", WSAESOCKTNOSUPPORT, "Socket type not supported");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ETIME
|
||||
inscode(d, ds, de, "ETIME", ETIME, "Timer expired");
|
||||
#endif
|
||||
#ifdef EBFONT
|
||||
inscode(d, ds, de, "EBFONT", EBFONT, "Bad font file format");
|
||||
#endif
|
||||
#ifdef EDEADLOCK
|
||||
inscode(d, ds, de, "EDEADLOCK", EDEADLOCK, "Error EDEADLOCK");
|
||||
#endif
|
||||
#ifdef ETOOMANYREFS
|
||||
inscode(d, ds, de, "ETOOMANYREFS", ETOOMANYREFS, "Too many references: cannot splice");
|
||||
#else
|
||||
#ifdef WSAETOOMANYREFS
|
||||
inscode(d, ds, de, "ETOOMANYREFS", WSAETOOMANYREFS, "Too many references: cannot splice");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef EMFILE
|
||||
inscode(d, ds, de, "EMFILE", EMFILE, "Too many open files");
|
||||
#else
|
||||
#ifdef WSAEMFILE
|
||||
inscode(d, ds, de, "EMFILE", WSAEMFILE, "Too many open files");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ETXTBSY
|
||||
inscode(d, ds, de, "ETXTBSY", ETXTBSY, "Text file busy");
|
||||
#endif
|
||||
#ifdef EINPROGRESS
|
||||
inscode(d, ds, de, "EINPROGRESS", EINPROGRESS, "Operation now in progress");
|
||||
#else
|
||||
#ifdef WSAEINPROGRESS
|
||||
inscode(d, ds, de, "EINPROGRESS", WSAEINPROGRESS, "Operation now in progress");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ENXIO
|
||||
inscode(d, ds, de, "ENXIO", ENXIO, "No such device or address");
|
||||
#endif
|
||||
#ifdef ENOPKG
|
||||
inscode(d, ds, de, "ENOPKG", ENOPKG, "Package not installed");
|
||||
#endif
|
||||
#ifdef WSASY
|
||||
inscode(d, ds, de, "WSASY", WSASY, "Error WSASY");
|
||||
#endif
|
||||
#ifdef WSAEHOSTDOWN
|
||||
inscode(d, ds, de, "WSAEHOSTDOWN", WSAEHOSTDOWN, "Host is down");
|
||||
#endif
|
||||
#ifdef WSAENETDOWN
|
||||
inscode(d, ds, de, "WSAENETDOWN", WSAENETDOWN, "Network is down");
|
||||
#endif
|
||||
#ifdef WSAENOTSOCK
|
||||
inscode(d, ds, de, "WSAENOTSOCK", WSAENOTSOCK, "Socket operation on non-socket");
|
||||
#endif
|
||||
#ifdef WSAEHOSTUNREACH
|
||||
inscode(d, ds, de, "WSAEHOSTUNREACH", WSAEHOSTUNREACH, "No route to host");
|
||||
#endif
|
||||
#ifdef WSAELOOP
|
||||
inscode(d, ds, de, "WSAELOOP", WSAELOOP, "Too many symbolic links encountered");
|
||||
#endif
|
||||
#ifdef WSAEMFILE
|
||||
inscode(d, ds, de, "WSAEMFILE", WSAEMFILE, "Too many open files");
|
||||
#endif
|
||||
#ifdef WSAESTALE
|
||||
inscode(d, ds, de, "WSAESTALE", WSAESTALE, "Stale NFS file handle");
|
||||
#endif
|
||||
#ifdef WSAVERNOTSUPPORTED
|
||||
inscode(d, ds, de, "WSAVERNOTSUPPORTED", WSAVERNOTSUPPORTED, "Error WSAVERNOTSUPPORTED");
|
||||
#endif
|
||||
#ifdef WSAENETUNREACH
|
||||
inscode(d, ds, de, "WSAENETUNREACH", WSAENETUNREACH, "Network is unreachable");
|
||||
#endif
|
||||
#ifdef WSAEPROCLIM
|
||||
inscode(d, ds, de, "WSAEPROCLIM", WSAEPROCLIM, "Error WSAEPROCLIM");
|
||||
#endif
|
||||
#ifdef WSAEFAULT
|
||||
inscode(d, ds, de, "WSAEFAULT", WSAEFAULT, "Bad address");
|
||||
#endif
|
||||
#ifdef WSANOTINITIALISED
|
||||
inscode(d, ds, de, "WSANOTINITIALISED", WSANOTINITIALISED, "Error WSANOTINITIALISED");
|
||||
#endif
|
||||
#ifdef WSAEUSERS
|
||||
inscode(d, ds, de, "WSAEUSERS", WSAEUSERS, "Too many users");
|
||||
#endif
|
||||
#ifdef WSAMAKEASYNCREPL
|
||||
inscode(d, ds, de, "WSAMAKEASYNCREPL", WSAMAKEASYNCREPL, "Error WSAMAKEASYNCREPL");
|
||||
#endif
|
||||
#ifdef WSAENOPROTOOPT
|
||||
inscode(d, ds, de, "WSAENOPROTOOPT", WSAENOPROTOOPT, "Protocol not available");
|
||||
#endif
|
||||
#ifdef WSAECONNABORTED
|
||||
inscode(d, ds, de, "WSAECONNABORTED", WSAECONNABORTED, "Software caused connection abort");
|
||||
#endif
|
||||
#ifdef WSAENAMETOOLONG
|
||||
inscode(d, ds, de, "WSAENAMETOOLONG", WSAENAMETOOLONG, "File name too long");
|
||||
#endif
|
||||
#ifdef WSAENOTEMPTY
|
||||
inscode(d, ds, de, "WSAENOTEMPTY", WSAENOTEMPTY, "Directory not empty");
|
||||
#endif
|
||||
#ifdef WSAESHUTDOWN
|
||||
inscode(d, ds, de, "WSAESHUTDOWN", WSAESHUTDOWN, "Cannot send after transport endpoint shutdown");
|
||||
#endif
|
||||
#ifdef WSAEAFNOSUPPORT
|
||||
inscode(d, ds, de, "WSAEAFNOSUPPORT", WSAEAFNOSUPPORT, "Address family not supported by protocol");
|
||||
#endif
|
||||
#ifdef WSAETOOMANYREFS
|
||||
inscode(d, ds, de, "WSAETOOMANYREFS", WSAETOOMANYREFS, "Too many references: cannot splice");
|
||||
#endif
|
||||
#ifdef WSAEACCES
|
||||
inscode(d, ds, de, "WSAEACCES", WSAEACCES, "Permission denied");
|
||||
#endif
|
||||
#ifdef WSATR
|
||||
inscode(d, ds, de, "WSATR", WSATR, "Error WSATR");
|
||||
#endif
|
||||
#ifdef WSABASEERR
|
||||
inscode(d, ds, de, "WSABASEERR", WSABASEERR, "Error WSABASEERR");
|
||||
#endif
|
||||
#ifdef WSADESCRIPTIO
|
||||
inscode(d, ds, de, "WSADESCRIPTIO", WSADESCRIPTIO, "Error WSADESCRIPTIO");
|
||||
#endif
|
||||
#ifdef WSAEMSGSIZE
|
||||
inscode(d, ds, de, "WSAEMSGSIZE", WSAEMSGSIZE, "Message too long");
|
||||
#endif
|
||||
#ifdef WSAEBADF
|
||||
inscode(d, ds, de, "WSAEBADF", WSAEBADF, "Bad file number");
|
||||
#endif
|
||||
#ifdef WSAECONNRESET
|
||||
inscode(d, ds, de, "WSAECONNRESET", WSAECONNRESET, "Connection reset by peer");
|
||||
#endif
|
||||
#ifdef WSAGETSELECTERRO
|
||||
inscode(d, ds, de, "WSAGETSELECTERRO", WSAGETSELECTERRO, "Error WSAGETSELECTERRO");
|
||||
#endif
|
||||
#ifdef WSAETIMEDOUT
|
||||
inscode(d, ds, de, "WSAETIMEDOUT", WSAETIMEDOUT, "Connection timed out");
|
||||
#endif
|
||||
#ifdef WSAENOBUFS
|
||||
inscode(d, ds, de, "WSAENOBUFS", WSAENOBUFS, "No buffer space available");
|
||||
#endif
|
||||
#ifdef WSAEDISCON
|
||||
inscode(d, ds, de, "WSAEDISCON", WSAEDISCON, "Error WSAEDISCON");
|
||||
#endif
|
||||
#ifdef WSAEINTR
|
||||
inscode(d, ds, de, "WSAEINTR", WSAEINTR, "Interrupted system call");
|
||||
#endif
|
||||
#ifdef WSAEPROTOTYPE
|
||||
inscode(d, ds, de, "WSAEPROTOTYPE", WSAEPROTOTYPE, "Protocol wrong type for socket");
|
||||
#endif
|
||||
#ifdef WSAHOS
|
||||
inscode(d, ds, de, "WSAHOS", WSAHOS, "Error WSAHOS");
|
||||
#endif
|
||||
#ifdef WSAEADDRINUSE
|
||||
inscode(d, ds, de, "WSAEADDRINUSE", WSAEADDRINUSE, "Address already in use");
|
||||
#endif
|
||||
#ifdef WSAEADDRNOTAVAIL
|
||||
inscode(d, ds, de, "WSAEADDRNOTAVAIL", WSAEADDRNOTAVAIL, "Cannot assign requested address");
|
||||
#endif
|
||||
#ifdef WSAEALREADY
|
||||
inscode(d, ds, de, "WSAEALREADY", WSAEALREADY, "Operation already in progress");
|
||||
#endif
|
||||
#ifdef WSAEPROTONOSUPPORT
|
||||
inscode(d, ds, de, "WSAEPROTONOSUPPORT", WSAEPROTONOSUPPORT, "Protocol not supported");
|
||||
#endif
|
||||
#ifdef WSASYSNOTREADY
|
||||
inscode(d, ds, de, "WSASYSNOTREADY", WSASYSNOTREADY, "Error WSASYSNOTREADY");
|
||||
#endif
|
||||
#ifdef WSAEWOULDBLOCK
|
||||
inscode(d, ds, de, "WSAEWOULDBLOCK", WSAEWOULDBLOCK, "Operation would block");
|
||||
#endif
|
||||
#ifdef WSAEPFNOSUPPORT
|
||||
inscode(d, ds, de, "WSAEPFNOSUPPORT", WSAEPFNOSUPPORT, "Protocol family not supported");
|
||||
#endif
|
||||
#ifdef WSAEOPNOTSUPP
|
||||
inscode(d, ds, de, "WSAEOPNOTSUPP", WSAEOPNOTSUPP, "Operation not supported on transport endpoint");
|
||||
#endif
|
||||
#ifdef WSAEISCONN
|
||||
inscode(d, ds, de, "WSAEISCONN", WSAEISCONN, "Transport endpoint is already connected");
|
||||
#endif
|
||||
#ifdef WSAEDQUOT
|
||||
inscode(d, ds, de, "WSAEDQUOT", WSAEDQUOT, "Quota exceeded");
|
||||
#endif
|
||||
#ifdef WSAENOTCONN
|
||||
inscode(d, ds, de, "WSAENOTCONN", WSAENOTCONN, "Transport endpoint is not connected");
|
||||
#endif
|
||||
#ifdef WSAEREMOTE
|
||||
inscode(d, ds, de, "WSAEREMOTE", WSAEREMOTE, "Object is remote");
|
||||
#endif
|
||||
#ifdef WSAEINVAL
|
||||
inscode(d, ds, de, "WSAEINVAL", WSAEINVAL, "Invalid argument");
|
||||
#endif
|
||||
#ifdef WSAEINPROGRESS
|
||||
inscode(d, ds, de, "WSAEINPROGRESS", WSAEINPROGRESS, "Operation now in progress");
|
||||
#endif
|
||||
#ifdef WSAGETSELECTEVEN
|
||||
inscode(d, ds, de, "WSAGETSELECTEVEN", WSAGETSELECTEVEN, "Error WSAGETSELECTEVEN");
|
||||
#endif
|
||||
#ifdef WSAESOCKTNOSUPPORT
|
||||
inscode(d, ds, de, "WSAESOCKTNOSUPPORT", WSAESOCKTNOSUPPORT, "Socket type not supported");
|
||||
#endif
|
||||
#ifdef WSAGETASYNCERRO
|
||||
inscode(d, ds, de, "WSAGETASYNCERRO", WSAGETASYNCERRO, "Error WSAGETASYNCERRO");
|
||||
#endif
|
||||
#ifdef WSAMAKESELECTREPL
|
||||
inscode(d, ds, de, "WSAMAKESELECTREPL", WSAMAKESELECTREPL, "Error WSAMAKESELECTREPL");
|
||||
#endif
|
||||
#ifdef WSAGETASYNCBUFLE
|
||||
inscode(d, ds, de, "WSAGETASYNCBUFLE", WSAGETASYNCBUFLE, "Error WSAGETASYNCBUFLE");
|
||||
#endif
|
||||
#ifdef WSAEDESTADDRREQ
|
||||
inscode(d, ds, de, "WSAEDESTADDRREQ", WSAEDESTADDRREQ, "Destination address required");
|
||||
#endif
|
||||
#ifdef WSAECONNREFUSED
|
||||
inscode(d, ds, de, "WSAECONNREFUSED", WSAECONNREFUSED, "Connection refused");
|
||||
#endif
|
||||
#ifdef WSAENETRESET
|
||||
inscode(d, ds, de, "WSAENETRESET", WSAENETRESET, "Network dropped connection because of reset");
|
||||
#endif
|
||||
#ifdef WSAN
|
||||
inscode(d, ds, de, "WSAN", WSAN, "Error WSAN");
|
||||
#endif
|
||||
|
||||
/* These symbols are added for EDK II support. */
|
||||
#ifdef EMINERRORVAL
|
||||
inscode(d, ds, de, "EMINERRORVAL", EMINERRORVAL, "Lowest valid error value");
|
||||
#endif
|
||||
#ifdef ENOTSUP
|
||||
inscode(d, ds, de, "ENOTSUP", ENOTSUP, "Operation not supported");
|
||||
#endif
|
||||
#ifdef EBADRPC
|
||||
inscode(d, ds, de, "EBADRPC", EBADRPC, "RPC struct is bad");
|
||||
#endif
|
||||
#ifdef ERPCMISMATCH
|
||||
inscode(d, ds, de, "ERPCMISMATCH", ERPCMISMATCH, "RPC version wrong");
|
||||
#endif
|
||||
#ifdef EPROGUNAVAIL
|
||||
inscode(d, ds, de, "EPROGUNAVAIL", EPROGUNAVAIL, "RPC prog. not avail");
|
||||
#endif
|
||||
#ifdef EPROGMISMATCH
|
||||
inscode(d, ds, de, "EPROGMISMATCH", EPROGMISMATCH, "Program version wrong");
|
||||
#endif
|
||||
#ifdef EPROCUNAVAIL
|
||||
inscode(d, ds, de, "EPROCUNAVAIL", EPROCUNAVAIL, "Bad procedure for program");
|
||||
#endif
|
||||
#ifdef EFTYPE
|
||||
inscode(d, ds, de, "EFTYPE", EFTYPE, "Inappropriate file type or format");
|
||||
#endif
|
||||
#ifdef EAUTH
|
||||
inscode(d, ds, de, "EAUTH", EAUTH, "Authentication error");
|
||||
#endif
|
||||
#ifdef ENEEDAUTH
|
||||
inscode(d, ds, de, "ENEEDAUTH", ENEEDAUTH, "Need authenticator");
|
||||
#endif
|
||||
#ifdef ECANCELED
|
||||
inscode(d, ds, de, "ECANCELED", ECANCELED, "Operation canceled");
|
||||
#endif
|
||||
#ifdef ENOATTR
|
||||
inscode(d, ds, de, "ENOATTR", ENOATTR, "Attribute not found");
|
||||
#endif
|
||||
#ifdef EDOOFUS
|
||||
inscode(d, ds, de, "EDOOFUS", EDOOFUS, "Programming Error");
|
||||
#endif
|
||||
#ifdef EBUFSIZE
|
||||
inscode(d, ds, de, "EBUFSIZE", EBUFSIZE, "Buffer too small to hold result");
|
||||
#endif
|
||||
#ifdef EMAXERRORVAL
|
||||
inscode(d, ds, de, "EMAXERRORVAL", EMAXERRORVAL, "One more than the highest defined error value");
|
||||
#endif
|
||||
|
||||
Py_DECREF(de);
|
||||
}
|
1912
AppPkg/Applications/Python/PyMod-2.7.2/Modules/selectmodule.c
Normal file
1912
AppPkg/Applications/Python/PyMod-2.7.2/Modules/selectmodule.c
Normal file
File diff suppressed because it is too large
Load Diff
250
AppPkg/Applications/Python/PyMod-2.7.2/Modules/socketmodule.h
Normal file
250
AppPkg/Applications/Python/PyMod-2.7.2/Modules/socketmodule.h
Normal file
@@ -0,0 +1,250 @@
|
||||
/* Socket module header file */
|
||||
|
||||
/* Includes needed for the sockaddr_* symbols below */
|
||||
#ifndef MS_WINDOWS
|
||||
#ifdef __VMS
|
||||
# include <socket.h>
|
||||
# else
|
||||
# include <sys/socket.h>
|
||||
# endif
|
||||
# include <netinet/in.h>
|
||||
# if !(defined(UEFI_ENV) || defined(__BEOS__) || defined(__CYGWIN__) || (defined(PYOS_OS2) && defined(PYCC_VACPP)))
|
||||
# include <netinet/tcp.h>
|
||||
# endif
|
||||
|
||||
#else /* MS_WINDOWS */
|
||||
# include <winsock2.h>
|
||||
# include <ws2tcpip.h>
|
||||
/* VC6 is shipped with old platform headers, and does not have MSTcpIP.h
|
||||
* Separate SDKs have all the functions we want, but older ones don't have
|
||||
* any version information.
|
||||
* I use SIO_GET_MULTICAST_FILTER to detect a decent SDK.
|
||||
*/
|
||||
# ifdef SIO_GET_MULTICAST_FILTER
|
||||
# include <MSTcpIP.h> /* for SIO_RCVALL */
|
||||
# define HAVE_ADDRINFO
|
||||
# define HAVE_SOCKADDR_STORAGE
|
||||
# define HAVE_GETADDRINFO
|
||||
# define HAVE_GETNAMEINFO
|
||||
# define ENABLE_IPV6
|
||||
# else
|
||||
typedef int socklen_t;
|
||||
# endif /* IPPROTO_IPV6 */
|
||||
#endif /* MS_WINDOWS */
|
||||
|
||||
#ifdef HAVE_SYS_UN_H
|
||||
# include <sys/un.h>
|
||||
#else
|
||||
# undef AF_UNIX
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LINUX_NETLINK_H
|
||||
# ifdef HAVE_ASM_TYPES_H
|
||||
# include <asm/types.h>
|
||||
# endif
|
||||
# include <linux/netlink.h>
|
||||
#else
|
||||
# undef AF_NETLINK
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BLUETOOTH_BLUETOOTH_H
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/rfcomm.h>
|
||||
#include <bluetooth/l2cap.h>
|
||||
#include <bluetooth/sco.h>
|
||||
#include <bluetooth/hci.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BLUETOOTH_H
|
||||
#include <bluetooth.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETPACKET_PACKET_H
|
||||
# include <sys/ioctl.h>
|
||||
# include <net/if.h>
|
||||
# include <netpacket/packet.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LINUX_TIPC_H
|
||||
# include <linux/tipc.h>
|
||||
#endif
|
||||
|
||||
#ifndef Py__SOCKET_H
|
||||
#define Py__SOCKET_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Python module and C API name */
|
||||
#define PySocket_MODULE_NAME "_socket"
|
||||
#define PySocket_CAPI_NAME "CAPI"
|
||||
#define PySocket_CAPSULE_NAME (PySocket_MODULE_NAME "." PySocket_CAPI_NAME)
|
||||
|
||||
/* Abstract the socket file descriptor type */
|
||||
#ifdef MS_WINDOWS
|
||||
typedef SOCKET SOCKET_T;
|
||||
# ifdef MS_WIN64
|
||||
# define SIZEOF_SOCKET_T 8
|
||||
# else
|
||||
# define SIZEOF_SOCKET_T 4
|
||||
# endif
|
||||
#else
|
||||
typedef int SOCKET_T;
|
||||
# define SIZEOF_SOCKET_T SIZEOF_INT
|
||||
#endif
|
||||
|
||||
/* Socket address */
|
||||
typedef union sock_addr {
|
||||
struct sockaddr_in in;
|
||||
#ifdef AF_UNIX
|
||||
struct sockaddr_un un;
|
||||
#endif
|
||||
#ifdef AF_NETLINK
|
||||
struct sockaddr_nl nl;
|
||||
#endif
|
||||
#ifdef ENABLE_IPV6
|
||||
struct sockaddr_in6 in6;
|
||||
struct sockaddr_storage storage;
|
||||
#endif
|
||||
#ifdef HAVE_BLUETOOTH_BLUETOOTH_H
|
||||
struct sockaddr_l2 bt_l2;
|
||||
struct sockaddr_rc bt_rc;
|
||||
struct sockaddr_sco bt_sco;
|
||||
struct sockaddr_hci bt_hci;
|
||||
#endif
|
||||
#ifdef HAVE_NETPACKET_PACKET_H
|
||||
struct sockaddr_ll ll;
|
||||
#endif
|
||||
} sock_addr_t;
|
||||
|
||||
/* The object holding a socket. It holds some extra information,
|
||||
like the address family, which is used to decode socket address
|
||||
arguments properly. */
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
SOCKET_T sock_fd; /* Socket file descriptor */
|
||||
int sock_family; /* Address family, e.g., AF_INET */
|
||||
int sock_type; /* Socket type, e.g., SOCK_STREAM */
|
||||
int sock_proto; /* Protocol type, usually 0 */
|
||||
PyObject *(*errorhandler)(void); /* Error handler; checks
|
||||
errno, returns NULL and
|
||||
sets a Python exception */
|
||||
double sock_timeout; /* Operation timeout in seconds;
|
||||
0.0 means non-blocking */
|
||||
} PySocketSockObject;
|
||||
|
||||
/* --- C API ----------------------------------------------------*/
|
||||
|
||||
/* Short explanation of what this C API export mechanism does
|
||||
and how it works:
|
||||
|
||||
The _ssl module needs access to the type object defined in
|
||||
the _socket module. Since cross-DLL linking introduces a lot of
|
||||
problems on many platforms, the "trick" is to wrap the
|
||||
C API of a module in a struct which then gets exported to
|
||||
other modules via a PyCapsule.
|
||||
|
||||
The code in socketmodule.c defines this struct (which currently
|
||||
only contains the type object reference, but could very
|
||||
well also include other C APIs needed by other modules)
|
||||
and exports it as PyCapsule via the module dictionary
|
||||
under the name "CAPI".
|
||||
|
||||
Other modules can now include the socketmodule.h file
|
||||
which defines the needed C APIs to import and set up
|
||||
a static copy of this struct in the importing module.
|
||||
|
||||
After initialization, the importing module can then
|
||||
access the C APIs from the _socket module by simply
|
||||
referring to the static struct, e.g.
|
||||
|
||||
Load _socket module and its C API; this sets up the global
|
||||
PySocketModule:
|
||||
|
||||
if (PySocketModule_ImportModuleAndAPI())
|
||||
return;
|
||||
|
||||
|
||||
Now use the C API as if it were defined in the using
|
||||
module:
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O!|zz:ssl",
|
||||
|
||||
PySocketModule.Sock_Type,
|
||||
|
||||
(PyObject*)&Sock,
|
||||
&key_file, &cert_file))
|
||||
return NULL;
|
||||
|
||||
Support could easily be extended to export more C APIs/symbols
|
||||
this way. Currently, only the type object is exported,
|
||||
other candidates would be socket constructors and socket
|
||||
access functions.
|
||||
|
||||
*/
|
||||
|
||||
/* C API for usage by other Python modules */
|
||||
typedef struct {
|
||||
PyTypeObject *Sock_Type;
|
||||
PyObject *error;
|
||||
} PySocketModule_APIObject;
|
||||
|
||||
/* XXX The net effect of the following appears to be to define a function
|
||||
XXX named PySocketModule_APIObject in _ssl.c. It's unclear why it isn't
|
||||
XXX defined there directly.
|
||||
|
||||
>>> It's defined here because other modules might also want to use
|
||||
>>> the C API.
|
||||
|
||||
*/
|
||||
#ifndef PySocket_BUILDING_SOCKET
|
||||
|
||||
/* --- C API ----------------------------------------------------*/
|
||||
|
||||
/* Interfacestructure to C API for other modules.
|
||||
Call PySocketModule_ImportModuleAndAPI() to initialize this
|
||||
structure. After that usage is simple:
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O!|zz:ssl",
|
||||
&PySocketModule.Sock_Type, (PyObject*)&Sock,
|
||||
&key_file, &cert_file))
|
||||
return NULL;
|
||||
...
|
||||
*/
|
||||
|
||||
static
|
||||
PySocketModule_APIObject PySocketModule;
|
||||
|
||||
/* You *must* call this before using any of the functions in
|
||||
PySocketModule and check its outcome; otherwise all accesses will
|
||||
result in a segfault. Returns 0 on success. */
|
||||
|
||||
#ifndef DPRINTF
|
||||
# define DPRINTF if (0) printf
|
||||
#endif
|
||||
|
||||
static
|
||||
int PySocketModule_ImportModuleAndAPI(void)
|
||||
{
|
||||
void *api;
|
||||
|
||||
DPRINTF(" Loading capsule %s\n", PySocket_CAPSULE_NAME);
|
||||
api = PyCapsule_Import(PySocket_CAPSULE_NAME, 1);
|
||||
if (api == NULL)
|
||||
goto onError;
|
||||
memcpy(&PySocketModule, api, sizeof(PySocketModule));
|
||||
DPRINTF(" API object loaded and initialized.\n");
|
||||
return 0;
|
||||
|
||||
onError:
|
||||
DPRINTF(" not found.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif /* !PySocket_BUILDING_SOCKET */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py__SOCKET_H */
|
@@ -161,8 +161,8 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
||||
#endif
|
||||
|
||||
#if (defined(_MSC_VER) && (_MSC_VER > 600))
|
||||
# if defined(_WIN32_WCE) || defined(_EFI_STDLIB)
|
||||
#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined(UEFI_ENV)
|
||||
# if defined(_WIN32_WCE)
|
||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
||||
# ifndef _PTRDIFF_T_DEFINED
|
||||
typedef int ptrdiff_t;
|
||||
|
Reference in New Issue
Block a user